Skip to content

Commit 3e69939

Browse files
committed
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.
1 parent 51e2cd3 commit 3e69939

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3068,7 +3068,8 @@ bool CWallet::CreateTransactionInternal(
30683068
tx = MakeTransactionRef(std::move(txNew));
30693069

30703070
// Limit size
3071-
if (GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT)
3071+
if ((sign && GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT) ||
3072+
(!sign && tx_sizes.second > MAX_STANDARD_TX_WEIGHT))
30723073
{
30733074
error = _("Transaction too large");
30743075
return false;

0 commit comments

Comments
 (0)