@@ -27,11 +27,6 @@ using interfaces::FoundBlock;
27
27
namespace wallet {
28
28
static constexpr size_t OUTPUT_GROUP_MAX_ENTRIES{100 };
29
29
30
- int GetTxSpendSize (const CWallet& wallet, const CWalletTx& wtx, unsigned int out, bool use_max_sig)
31
- {
32
- return CalculateMaximumSignedInputSize (wtx.tx ->vout [out], &wallet, use_max_sig);
33
- }
34
-
35
30
int CalculateMaximumSignedInputSize (const CTxOut& txout, const SigningProvider* provider, bool use_max_sig)
36
31
{
37
32
CMutableTransaction txn;
@@ -198,7 +193,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
198
193
// Filter by spendable outputs only
199
194
if (!spendable && only_spendable) continue ;
200
195
201
- int input_bytes = GetTxSpendSize (wallet, wtx, i, ( coinControl && coinControl->fAllowWatchOnly ) );
196
+ int input_bytes = CalculateMaximumSignedInputSize (output, provider. get (), coinControl && coinControl->fAllowWatchOnly );
202
197
result.coins .emplace_back (outpoint, output, nDepth, input_bytes, spendable, solvable, safeTx, wtx.GetTxTime (), tx_from_me, feerate);
203
198
result.total_amount += output.nValue ;
204
199
@@ -289,8 +284,9 @@ std::map<CTxDestination, std::vector<COutput>> ListCoins(const CWallet& wallet)
289
284
) {
290
285
CTxDestination address;
291
286
if (ExtractDestination (FindNonChangeParentOutput (wallet, *wtx.tx , output.n ).scriptPubKey , address)) {
287
+ const auto out = wtx.tx ->vout .at (output.n );
292
288
result[address].emplace_back (
293
- COutPoint (wtx.GetHash (), output.n ), wtx. tx -> vout . at (output. n ) , depth, GetTxSpendSize (wallet, wtx, output. n ), /* spendable=*/ true , /* solvable=*/ true , /* safe=*/ false , wtx.GetTxTime (), CachedTxIsFromMe (wallet, wtx, ISMINE_ALL));
289
+ COutPoint (wtx.GetHash (), output.n ), out , depth, CalculateMaximumSignedInputSize (out, &wallet, false ), /* spendable=*/ true , /* solvable=*/ true , /* safe=*/ false , wtx.GetTxTime (), CachedTxIsFromMe (wallet, wtx, ISMINE_ALL));
294
290
}
295
291
}
296
292
}
@@ -447,7 +443,7 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, const std::vec
447
443
if (ptr_wtx->tx ->vout .size () <= outpoint.n ) {
448
444
return std::nullopt;
449
445
}
450
- input_bytes = GetTxSpendSize (wallet, * ptr_wtx, outpoint.n , false );
446
+ input_bytes = CalculateMaximumSignedInputSize ( ptr_wtx-> tx -> vout [ outpoint.n ], &wallet , false );
451
447
txout = ptr_wtx->tx ->vout .at (outpoint.n );
452
448
} else {
453
449
// The input is external. We did not find the tx in mapWallet.
0 commit comments