refactor: align TxToUniv argument list with upstream

In bitcoin#20286, a new `TxToUniv` will be defined and in order to
minimize upstream deviation caused by having to change function calls
to account for `const CSpentIndexTxInfo*` being placed _before_
`const CTxUndo*` (requiring us to therefore specify `nullptr` as those
calls do not expect spend information) instead of letting the default
value remain. To allow for that, their ordering will be swapped.

To prevent a confusion with the last two arguments between the
`core_io` definition and the `rpc/blockchain` definition, let's do the
inversion here too before the backport.
This commit is contained in:
Kittywhiskers Van Gogh 2024-06-23 12:47:57 +00:00
parent b316be7680
commit ec0803a0f5
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
4 changed files with 4 additions and 4 deletions

View File

@ -47,6 +47,6 @@ std::string EncodeHexTx(const CTransaction& tx);
std::string SighashToStr(unsigned char sighash_type); std::string SighashToStr(unsigned char sighash_type);
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex); void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
void ScriptToUniv(const CScript& script, UniValue& out, bool include_address); void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, const CSpentIndexTxInfo* ptxSpentInfo = nullptr, const CTxUndo* txundo = nullptr); void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, const CTxUndo* txundo = nullptr, const CSpentIndexTxInfo* ptxSpentInfo = nullptr);
#endif // BITCOIN_CORE_IO_H #endif // BITCOIN_CORE_IO_H

View File

@ -192,7 +192,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
out.pushKV("addresses", a); out.pushKV("addresses", a);
} }
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, const CSpentIndexTxInfo* ptxSpentInfo, const CTxUndo* txundo) void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, const CTxUndo* txundo, const CSpentIndexTxInfo* ptxSpentInfo)
{ {
uint256 txid = tx.GetHash(); uint256 txid = tx.GetHash();
entry.pushKV("txid", txid.GetHex()); entry.pushKV("txid", txid.GetHex());

View File

@ -226,7 +226,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIn
// coinbase transaction (i == 0) doesn't have undo data // coinbase transaction (i == 0) doesn't have undo data
const CTxUndo* txundo = (have_undo && i) ? &blockUndo.vtxundo.at(i - 1) : nullptr; const CTxUndo* txundo = (have_undo && i) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
UniValue objTx(UniValue::VOBJ); UniValue objTx(UniValue::VOBJ);
TxToUniv(*tx, uint256(), objTx, true, nullptr, txundo); TxToUniv(*tx, uint256(), objTx, true, txundo);
bool fLocked = isman.IsLocked(tx->GetHash()); bool fLocked = isman.IsLocked(tx->GetHash());
objTx.pushKV("instantlock", fLocked || result["chainlock"].get_bool()); objTx.pushKV("instantlock", fLocked || result["chainlock"].get_bool());
objTx.pushKV("instantlock_internal", fLocked); objTx.pushKV("instantlock_internal", fLocked);

View File

@ -84,7 +84,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, CTxMemPool& mempo
} }
} }
TxToUniv(tx, uint256(), entry, true, &txSpentInfo); TxToUniv(tx, uint256(), entry, true, /* txundo = */ nullptr, &txSpentInfo);
bool chainLock = false; bool chainLock = false;
if (!hashBlock.IsNull()) { if (!hashBlock.IsNull()) {