mining: add getTransactionsByTxID() IPC method

This commit is contained in:
Sjors Provoost
2025-12-05 19:50:58 +01:00
parent 0d5e4d4712
commit d282ae6883
6 changed files with 65 additions and 2 deletions

View File

@@ -184,6 +184,16 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
const auto high_fee_tx{entry.Fee(50000).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx)};
TryAddToMempool(tx_mempool, high_fee_tx);
// Test getTransactionsByTxID()
const std::vector<Txid> tx_id_list{
hashParentTx,
Txid::FromUint256(uint256::ZERO) // non-existing tx
};
auto raw_txs = mining->getTransactionsByTxID(tx_id_list);
BOOST_REQUIRE_EQUAL(raw_txs.size(), tx_id_list.size());
BOOST_CHECK(raw_txs[0]);
BOOST_CHECK(raw_txs[0]->GetHash() == hashParentTx);
BOOST_CHECK(!raw_txs[1]);
block_template = mining->createNewBlock(options, /*cooldown=*/false);
BOOST_REQUIRE(block_template);
block = block_template->getBlock();