Skip to content

Commit 05c319e

Browse files
committed
refactor: move oversized transaction check to tail end of scope
Change needed so that next commit can extend check to include post-signature size.
1 parent 6ca51df commit 05c319e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/wallet/spend.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,6 @@ bool CWallet::CreateTransactionInternal(
796796
nBytes += GetSizeOfCompactSize(nExtraPayloadSize) + nExtraPayloadSize;
797797
}
798798

799-
if (static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE) {
800-
// Do not create oversized transactions (bad-txns-oversize).
801-
error = _("Transaction too large");
802-
return false;
803-
}
804-
805799
// Remove scriptSigs to eliminate the fee calculation dummy signatures
806800
for (auto& txin : txNew.vin) {
807801
txin.scriptSig = CScript();
@@ -962,6 +956,12 @@ bool CWallet::CreateTransactionInternal(
962956

963957
// Return the constructed transaction data.
964958
tx = MakeTransactionRef(std::move(txNew));
959+
960+
// Limit size
961+
if (static_cast<size_t>(nBytes) > MAX_STANDARD_TX_SIZE) {
962+
error = _("Transaction too large");
963+
return false;
964+
}
965965
}
966966

967967
if (nFeeRet > m_default_max_tx_fee) {

0 commit comments

Comments
 (0)