diff --git a/doc/release-notes-31175.md b/doc/release-notes-31175.md new file mode 100644 index 0000000000..84a04a7426 --- /dev/null +++ b/doc/release-notes-31175.md @@ -0,0 +1,8 @@ +RPC +--- + +Duplicate blocks submitted with `submitblock` will now persist their block data +even if it was previously pruned. If pruning is activated, the data will be +pruned again eventually once the block file it is persisted in is selected for +pruning. This is consistent with the behaviour of `getblockfrompeer` where the +block is persisted as well even when pruning. diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 47a5bce22b..77fef83a5b 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -1016,17 +1016,6 @@ static RPCHelpMan submitblock() } ChainstateManager& chainman = EnsureAnyChainman(request.context); - uint256 hash = block.GetHash(); - { - LOCK(cs_main); - const CBlockIndex* pindex = chainman.m_blockman.LookupBlockIndex(hash); - if (pindex) { - if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) { - return "duplicate"; - } - } - } - { LOCK(cs_main); const CBlockIndex* pindex = chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock);