mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-27 22:42:34 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user