Skip to content

Commit ec0803a

Browse files
committed
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.
1 parent b316be7 commit ec0803a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/core_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ std::string EncodeHexTx(const CTransaction& tx);
4747
std::string SighashToStr(unsigned char sighash_type);
4848
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
4949
void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
50-
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, const CSpentIndexTxInfo* ptxSpentInfo = nullptr, const CTxUndo* txundo = nullptr);
50+
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, const CTxUndo* txundo = nullptr, const CSpentIndexTxInfo* ptxSpentInfo = nullptr);
5151

5252
#endif // BITCOIN_CORE_IO_H

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
192192
out.pushKV("addresses", a);
193193
}
194194

195-
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, const CSpentIndexTxInfo* ptxSpentInfo, const CTxUndo* txundo)
195+
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, const CTxUndo* txundo, const CSpentIndexTxInfo* ptxSpentInfo)
196196
{
197197
uint256 txid = tx.GetHash();
198198
entry.pushKV("txid", txid.GetHex());

src/rpc/blockchain.cpp

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

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, CTxMemPool& mempo
8484
}
8585
}
8686

87-
TxToUniv(tx, uint256(), entry, true, &txSpentInfo);
87+
TxToUniv(tx, uint256(), entry, true, /* txundo = */ nullptr, &txSpentInfo);
8888

8989
bool chainLock = false;
9090
if (!hashBlock.IsNull()) {

0 commit comments

Comments
 (0)