Merge #744: Fix finalizecompactblock filling in more found txs from mempool

cb90cdb7b Fix finalizecompactblock filling in more found txs from mempool (Gregory Sanders)

Pull request description:

  If you instantiate `InitData` with a non-empty mempool, it may find "missing transactions", fill them in, and then the missing transaction index vector is now faulty and fails.

  All data is already available to finish the block(or not in case of collision), just use given data.

  Fixes intermittent feature_blocksign.py failure.

Tree-SHA512: d0d984b72daf710a1889c1e7032fe4fc81a26701d595441d9978bd6ab37f59b3a90df52a45df120007eb9465c6c4879807b6bea3602bb32ed1c05814d041c6fb
This commit is contained in:
Steven Roose 2019-10-10 17:05:15 +01:00
commit 8fd1b52f9d
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87

View file

@ -1376,9 +1376,9 @@ UniValue finalizecompactblock(const JSONRPCRequest& request)
// Make mega-list
found.insert(found.end(), transactions.txn.begin(), transactions.txn.end());
// Now construct the final block!
LOCK(mempool.cs);
PartiallyDownloadedBlock partialBlock(&mempool);
// Now construct the final block! (use dummy mempool here, otherwise reconstruction may fail)
CTxMemPool dummy_pool;
PartiallyDownloadedBlock partialBlock(&dummy_pool);
const std::vector<std::pair<uint256, CTransactionRef>> dummy;
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();