Skip to content

Commit ab756ba

Browse files
committed
wallet: Fail if maximum weight is too large
Courtesy of 3e69939 from bitcoin#20536
1 parent 05c319e commit ab756ba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/spend.cpp

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

960960
// Limit size
961-
if (static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE) {
961+
if ((sign && ::GetSerializeSize(*tx, PROTOCOL_VERSION) > MAX_STANDARD_TX_SIZE) ||
962+
(!sign && static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE)) {
962963
error = _("Transaction too large");
963964
return false;
964965
}

0 commit comments

Comments
 (0)