Skip to content

Commit 6801983

Browse files
committed
wallet: Use GetSizeOfCompactSizeDiff in CreateTransaction
1 parent 8d4dcd2 commit 6801983

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/wallet/wallet.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,8 +3975,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
39753975
// change output. Only try this once.
39763976
if (nChangePosInOut == -1 && nSubtractFeeFromAmount == 0 && pick_new_inputs) {
39773977
// Adding another output can change the serialized size of the vout size
3978-
unsigned int nBytesCompactSizeDiff = GetSizeOfCompactSize(txNew.vout.size() + 1) - GetSizeOfCompactSize(0);
3979-
unsigned int tx_size_with_change = nBytes + change_prototype_size + nBytesCompactSizeDiff;
3978+
unsigned int tx_size_with_change = nBytes + change_prototype_size + GetSizeOfCompactSizeDiff(0, txNew.vout.size() + 1);
39803979
CAmount fee_needed_with_change = GetMinimumFee(tx_size_with_change, coin_control, ::mempool, ::feeEstimator, nullptr);
39813980
CAmount minimum_value_for_change = GetDustThreshold(change_prototype_txout, discard_rate);
39823981
if (nFeeRet >= fee_needed_with_change + minimum_value_for_change) {

0 commit comments

Comments
 (0)