diff options
author | Jorge Timón <jtimon@jtimon.cc> | 2016-08-11 04:42:36 +0200 |
---|---|---|
committer | Jorge Timón <jtimon@jtimon.cc> | 2017-09-20 23:25:52 +0200 |
commit | 832e0744cb8b1e1625cdb19b257f97316ac16a90 (patch) | |
tree | 401102620abe59c6ab82e9a9008ecece577d81a3 /src/consensus/tx_verify.h | |
parent | 3f0ee3e5011430461c7c61f4f2d406bf3cd8b54b (diff) |
Optimization: Minimize the number of times it is checked that no money is created
by individual transactions to 2 places (but call only once in each):
- ConnectBlock ( before calculated fees per txs twice )
- AcceptToMemoryPoolWorker ( before called CheckTxInputs 4 times and calculated
fees per tx one extra time )
Also call tx.GetValueOut() only once per call of CheckTxInputs (instead of 2)
Diffstat (limited to 'src/consensus/tx_verify.h')
-rw-r--r-- | src/consensus/tx_verify.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h index d46d3294ca..288892462d 100644 --- a/src/consensus/tx_verify.h +++ b/src/consensus/tx_verify.h @@ -5,6 +5,8 @@ #ifndef BITCOIN_CONSENSUS_TX_VERIFY_H #define BITCOIN_CONSENSUS_TX_VERIFY_H +#include "amount.h" + #include <stdint.h> #include <vector> @@ -22,9 +24,10 @@ namespace Consensus { /** * Check whether all inputs of this transaction are valid (no double spends and amounts) * This does not modify the UTXO set. This does not check scripts and sigs. + * @param[out] txfee Set to the transaction fee if successful. * Preconditions: tx.IsCoinBase() is false. */ -bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight); +bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee); } // namespace Consensus /** Auxiliary functions for transaction validation (ideally should not be exposed) */ |