Skip to content

Commit

Permalink
wallet: Fail if maximum weight is too large
Browse files Browse the repository at this point in the history
Courtesy of 3e69939 from bitcoin#20536
  • Loading branch information
kwvg committed Feb 9, 2025
1 parent 05c319e commit ab756ba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wallet/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,8 @@ bool CWallet::CreateTransactionInternal(
tx = MakeTransactionRef(std::move(txNew));

// Limit size
if (static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE) {
if ((sign && ::GetSerializeSize(*tx, PROTOCOL_VERSION) > MAX_STANDARD_TX_SIZE) ||
(!sign && static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE)) {
error = _("Transaction too large");
return false;
}
Expand Down

0 comments on commit ab756ba

Please sign in to comment.