refactor: Convert RPCs and merkleblock from uint256 to Txid

This commit is contained in:
marcofleon
2025-07-23 17:16:09 +01:00
parent 49b3d3a92a
commit 326f244724
12 changed files with 78 additions and 80 deletions

View File

@@ -322,10 +322,10 @@ static RPCHelpMan getrawtransaction()
const NodeContext& node = EnsureAnyNodeContext(request.context);
ChainstateManager& chainman = EnsureChainman(node);
uint256 hash = ParseHashV(request.params[0], "parameter 1");
auto txid{Txid::FromUint256(ParseHashV(request.params[0], "parameter 1"))};
const CBlockIndex* blockindex = nullptr;
if (hash == chainman.GetParams().GenesisBlock().hashMerkleRoot) {
if (txid.ToUint256() == chainman.GetParams().GenesisBlock().hashMerkleRoot) {
// Special exception for the genesis block coinbase transaction
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "The genesis block coinbase is not considered an ordinary transaction and cannot be retrieved");
}
@@ -348,7 +348,7 @@ static RPCHelpMan getrawtransaction()
}
uint256 hash_block;
const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), hash, hash_block, chainman.m_blockman);
const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), txid, hash_block, chainman.m_blockman);
if (!tx) {
std::string errmsg;
if (blockindex) {