diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-07-22 15:47:06 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-08-18 11:00:13 -0400 |
commit | eb879634db2116b23e884dab21318743f974f1f3 (patch) | |
tree | dc2dd593c49a48e3ca2cdb86c99e2629a841b64f /src | |
parent | a537d7aaa069bc216aeab381bbc4d312b5ffedf1 (diff) | |
download | bitcoin-eb879634db2116b23e884dab21318743f974f1f3.tar.xz |
wallet: Try estimating input size with external data if wallet fails
Instead of choosing whether to use the wallet or external data when
estimating the size of an input, first use the wallet, then try external
data if that failed.
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/spend.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index bffb665fa8..001acd04e2 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -569,8 +569,12 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& a if (!coin_control.GetExternalOutput(outpoint, txout)) { return std::nullopt; } + } + + if (input_bytes == -1) { input_bytes = CalculateMaximumSignedInputSize(txout, outpoint, &coin_control.m_external_provider, &coin_control); } + // If available, override calculated size with coin control specified size if (coin_control.HasInputWeight(outpoint)) { input_bytes = GetVirtualTransactionSize(coin_control.GetInputWeight(outpoint), 0, 0); |