Skip to content

Commit fac39c1

Browse files
author
MarcoFalke
committed
wallet: document that tx in CreateTransaction is purely an out-param
1 parent faac315 commit fac39c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3109,13 +3109,14 @@ bool CWallet::CreateTransaction(
31093109
bool sign)
31103110
{
31113111
int nChangePosIn = nChangePosInOut;
3112-
CTransactionRef tx2 = tx;
3112+
Assert(!tx); // tx is an out-param. TODO change the return type from bool to tx (or nullptr)
31133113
bool res = CreateTransactionInternal(vecSend, tx, nFeeRet, nChangePosInOut, error, coin_control, fee_calc_out, sign);
31143114
// try with avoidpartialspends unless it's enabled already
31153115
if (res && nFeeRet > 0 /* 0 means non-functional fee rate estimation */ && m_max_aps_fee > -1 && !coin_control.m_avoid_partial_spends) {
31163116
CCoinControl tmp_cc = coin_control;
31173117
tmp_cc.m_avoid_partial_spends = true;
31183118
CAmount nFeeRet2;
3119+
CTransactionRef tx2;
31193120
int nChangePosInOut2 = nChangePosIn;
31203121
bilingual_str error2; // fired and forgotten; if an error occurs, we discard the results
31213122
if (CreateTransactionInternal(vecSend, tx2, nFeeRet2, nChangePosInOut2, error2, tmp_cc, fee_calc_out, sign)) {

0 commit comments

Comments
 (0)