aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorGregory Sanders <gsanders87@gmail.com>2018-10-03 14:41:03 +0900
committerGregory Sanders <gsanders87@gmail.com>2018-11-12 13:12:09 -0500
commit0fb2e69815bd5146e601a7fd3585f21a1fdd6f5d (patch)
treeacfb980599ed7acc72c31292bb56e67e32841e46 /src/wallet/wallet.cpp
parentb06483c96a83af3f7721d01c4cafe3edf5909552 (diff)
downloadbitcoin-0fb2e69815bd5146e601a7fd3585f21a1fdd6f5d.tar.xz
CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 79e3b5b22b..eff94455db 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2753,7 +2753,14 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
if (pick_new_inputs) {
nValueIn = 0;
setCoins.clear();
- coin_selection_params.change_spend_size = CalculateMaximumSignedInputSize(change_prototype_txout, this);
+ int change_spend_size = CalculateMaximumSignedInputSize(change_prototype_txout, this);
+ // If the wallet doesn't know how to sign change output, assume p2sh-p2wpkh
+ // as lower-bound to allow BnB to do it's thing
+ if (change_spend_size == -1) {
+ coin_selection_params.change_spend_size = DUMMY_NESTED_P2WPKH_INPUT_SIZE;
+ } else {
+ coin_selection_params.change_spend_size = (size_t)change_spend_size;
+ }
coin_selection_params.effective_fee = nFeeRateNeeded;
if (!SelectCoins(vAvailableCoins, nValueToSelect, setCoins, nValueIn, coin_control, coin_selection_params, bnb_used))
{