Add check that GetSortedScoreWithTopology() agrees with CompareMiningScoreWithTopology()
We use CompareMiningScoreWithTopology() for sorting transaction announcements during tx relay, and we use GetSortedScoreWithTopology() in CTxMemPool::check().
This commit is contained in:
1 parent
a86ac11768
commit
79f73ad713
1 file changed
+9
@@ -425,11 +425,20 @@ void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendhei
|
|||||||
|
|
||||||
CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(&active_coins_tip));
|
CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(&active_coins_tip));
|
||||||
|
|
||||||
|
std::optional<Wtxid> last_wtxid = std::nullopt;
|
||||||
|
|
||||||
for (const auto& it : GetSortedScoreWithTopology()) {
|
for (const auto& it : GetSortedScoreWithTopology()) {
|
||||||
checkTotal += it->GetTxSize();
|
checkTotal += it->GetTxSize();
|
||||||
check_total_fee += it->GetFee();
|
check_total_fee += it->GetFee();
|
||||||
innerUsage += it->DynamicMemoryUsage();
|
innerUsage += it->DynamicMemoryUsage();
|
||||||
const CTransaction& tx = it->GetTx();
|
const CTransaction& tx = it->GetTx();
|
||||||
|
|
||||||
|
// CompareMiningScoreWithTopology should agree with GetSortedScoreWithTopology()
|
||||||
|
if (last_wtxid) {
|
||||||
|
assert(CompareMiningScoreWithTopology(*last_wtxid, tx.GetWitnessHash()));
|
||||||
|
}
|
||||||
|
last_wtxid = tx.GetWitnessHash();
|
||||||
|
|
||||||
std::set<CTxMemPoolEntry::CTxMemPoolEntryRef, CompareIteratorByHash> setParentCheck;
|
std::set<CTxMemPoolEntry::CTxMemPoolEntryRef, CompareIteratorByHash> setParentCheck;
|
||||||
std::set<CTxMemPoolEntry::CTxMemPoolEntryRef, CompareIteratorByHash> setParentsStored;
|
std::set<CTxMemPoolEntry::CTxMemPoolEntryRef, CompareIteratorByHash> setParentsStored;
|
||||||
for (const CTxIn &txin : tx.vin) {
|
for (const CTxIn &txin : tx.vin) {
|
||||||
|
|||||||
Reference in new issue
Block a user