@@ -27,20 +27,20 @@ using interfaces::FoundBlock;
27
27
namespace wallet {
28
28
static constexpr size_t OUTPUT_GROUP_MAX_ENTRIES{100 };
29
29
30
- int CalculateMaximumSignedInputSize (const CTxOut& txout, const SigningProvider* provider, bool use_max_sig )
30
+ int CalculateMaximumSignedInputSize (const CTxOut& txout, const COutPoint outpoint, const SigningProvider* provider, const CCoinControl* coin_control )
31
31
{
32
32
CMutableTransaction txn;
33
- txn.vin .push_back (CTxIn (COutPoint () ));
34
- if (!provider || !DummySignInput (*provider, txn.vin [0 ], txout, use_max_sig )) {
33
+ txn.vin .push_back (CTxIn (outpoint ));
34
+ if (!provider || !DummySignInput (*provider, txn.vin [0 ], txout, coin_control )) {
35
35
return -1 ;
36
36
}
37
37
return GetVirtualTransactionInputSize (txn.vin [0 ]);
38
38
}
39
39
40
- int CalculateMaximumSignedInputSize (const CTxOut& txout, const CWallet* wallet, bool use_max_sig )
40
+ int CalculateMaximumSignedInputSize (const CTxOut& txout, const CWallet* wallet, const CCoinControl* coin_control )
41
41
{
42
42
const std::unique_ptr<SigningProvider> provider = wallet->GetSolvingProvider (txout.scriptPubKey );
43
- return CalculateMaximumSignedInputSize (txout, provider.get (), use_max_sig );
43
+ return CalculateMaximumSignedInputSize (txout, COutPoint (), provider.get (), coin_control );
44
44
}
45
45
46
46
// txouts needs to be in the order of tx.vin
@@ -193,7 +193,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
193
193
// Filter by spendable outputs only
194
194
if (!spendable && only_spendable) continue ;
195
195
196
- int input_bytes = CalculateMaximumSignedInputSize (output, provider.get (), coinControl && coinControl-> fAllowWatchOnly );
196
+ int input_bytes = CalculateMaximumSignedInputSize (output, COutPoint (), provider.get (), coinControl);
197
197
result.coins .emplace_back (outpoint, output, nDepth, input_bytes, spendable, solvable, safeTx, wtx.GetTxTime (), tx_from_me, feerate);
198
198
result.total_amount += output.nValue ;
199
199
@@ -286,7 +286,7 @@ std::map<CTxDestination, std::vector<COutput>> ListCoins(const CWallet& wallet)
286
286
if (ExtractDestination (FindNonChangeParentOutput (wallet, *wtx.tx , output.n ).scriptPubKey , address)) {
287
287
const auto out = wtx.tx ->vout .at (output.n );
288
288
result[address].emplace_back (
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));
289
+ COutPoint (wtx.GetHash (), output.n ), out, depth, CalculateMaximumSignedInputSize (out, &wallet, /* coin_control= */ nullptr ), /* spendable=*/ true , /* solvable=*/ true , /* safe=*/ false , wtx.GetTxTime (), CachedTxIsFromMe (wallet, wtx, ISMINE_ALL));
290
290
}
291
291
}
292
292
}
@@ -443,14 +443,14 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, const std::vec
443
443
if (ptr_wtx->tx ->vout .size () <= outpoint.n ) {
444
444
return std::nullopt;
445
445
}
446
- input_bytes = CalculateMaximumSignedInputSize (ptr_wtx->tx ->vout [outpoint.n ], &wallet, false );
447
446
txout = ptr_wtx->tx ->vout .at (outpoint.n );
447
+ input_bytes = CalculateMaximumSignedInputSize (txout, &wallet, &coin_control);
448
448
} else {
449
449
// The input is external. We did not find the tx in mapWallet.
450
450
if (!coin_control.GetExternalOutput (outpoint, txout)) {
451
451
return std::nullopt;
452
452
}
453
- input_bytes = CalculateMaximumSignedInputSize (txout, &coin_control.m_external_provider , /* use_max_sig= */ true );
453
+ input_bytes = CalculateMaximumSignedInputSize (txout, outpoint, &coin_control.m_external_provider , &coin_control );
454
454
}
455
455
// If available, override calculated size with coin control specified size
456
456
if (coin_control.HasInputWeight (outpoint)) {
0 commit comments