aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-11-30 16:13:36 -0500
committerAndrew Chow <achow101-github@achow101.com>2020-11-30 16:39:20 -0500
commit3e69939b78d0143d514c5d9b6c6a9844c9bb901c (patch)
tree6732f0059cd7f2bdbc8e95a23044f4573fe7572e /src/wallet/wallet.cpp
parent51e2cd322cfc7271af309e3a2243448a2ec0cad4 (diff)
downloadbitcoin-3e69939b78d0143d514c5d9b6c6a9844c9bb901c.tar.xz
Fail if maximum weight is too large
Our max weight check in CreateTransaction only worked if the transaction was fully signed. However if we are funding a transaction, it is possible that the tx weight will be too large for a standard tx. In that case, we should also fail. So we use the tx weight returned by CalculateMaximumSignedTxSize and check against the limit for those transactions.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 141842d921..3faa038df4 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3068,7 +3068,8 @@ bool CWallet::CreateTransactionInternal(
tx = MakeTransactionRef(std::move(txNew));
// Limit size
- if (GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT)
+ if ((sign && GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT) ||
+ (!sign && tx_sizes.second > MAX_STANDARD_TX_WEIGHT))
{
error = _("Transaction too large");
return false;