Skip to content

Commit 87d92fa

Browse files
committed
test: Add unit test coverage of package rbf + prioritisetransaction
1 parent 15d982f commit 87d92fa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/test/txpackage_tests.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,25 @@ BOOST_AUTO_TEST_CASE(package_rbf_tests)
10781078
BOOST_CHECK_EQUAL(it_child_3->second.m_effective_feerate.value().GetFee(package3_total_vsize), 199 + 1300);
10791079

10801080
BOOST_CHECK_EQUAL(m_node.mempool->size(), expected_pool_size);
1081-
}
10821081

1082+
// Finally, check that we can prioritise tx_child_1 to get package1 into the mempool.
1083+
// It should not be possible to resubmit package1 and get it in without prioritisation.
1084+
const auto submit4 = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, package1, false, std::nullopt);
1085+
if (auto err_4{CheckPackageMempoolAcceptResult(package1, submit4, /*expect_valid=*/false, m_node.mempool.get())}) {
1086+
BOOST_ERROR(err_4.value());
1087+
}
1088+
m_node.mempool->PrioritiseTransaction(tx_child_1->GetHash(), 1363);
1089+
const auto submit5 = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, package1, false, std::nullopt);
1090+
if (auto err_5{CheckPackageMempoolAcceptResult(package1, submit5, /*expect_valid=*/true, m_node.mempool.get())}) {
1091+
BOOST_ERROR(err_5.value());
1092+
}
1093+
it_parent_1 = submit5.m_tx_results.find(tx_parent_1->GetWitnessHash());
1094+
it_child_1 = submit5.m_tx_results.find(tx_child_1->GetWitnessHash());
1095+
BOOST_CHECK_EQUAL(it_parent_1->second.m_result_type, MempoolAcceptResult::ResultType::VALID);
1096+
BOOST_CHECK_EQUAL(it_child_1->second.m_result_type, MempoolAcceptResult::ResultType::VALID);
1097+
LOCK(m_node.mempool->cs);
1098+
BOOST_CHECK(m_node.mempool->GetIter(tx_parent_1->GetHash()).has_value());
1099+
BOOST_CHECK(m_node.mempool->GetIter(tx_child_1->GetHash()).has_value());
1100+
}
10831101
}
10841102
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)