Call CheckTransaction as a sanity check on newly created transactions.

This commit is contained in:
David Burkett 2022-04-08 00:44:41 -04:00 committed by Loshan T
parent dd4263abc8
commit a753b740e0

View File

@ -1,5 +1,6 @@
#include <wallet/txassembler.h>
#include <consensus/tx_check.h>
#include <consensus/validation.h>
#include <policy/policy.h>
#include <util/check.h>
@ -58,6 +59,11 @@ AssembledTx TxAssembler::CreateTransaction(
throw CreateTxError(_("Transaction too large"));
}
TxValidationState validation_state;
if (!CheckTransaction(*tx, validation_state)) {
throw CreateTxError(_("Transaction is invalid"));
}
if (new_tx.total_fee > m_wallet.m_default_max_tx_fee) {
throw CreateTxError(TransactionErrorString(TransactionError::MAX_FEE_EXCEEDED));
}