| 569 | // All the intermediate state that gets passed between the various levels |
| 570 | // of checking a given transaction. |
| 571 | struct Workspace { |
| 572 | // explicit Workspace(const CTransactionRef& ptx) : m_ptx(ptx), m_hash(ptx->GetHash()) {} // ELEMENTS: unused since we need the genesis block hash |
| 573 | explicit Workspace(const CTransactionRef& ptx, const uint256& hash_genesis_block) : m_ptx(ptx), m_hash(ptx->GetHash()), m_precomputed_txdata(hash_genesis_block) {} // ELEMENTS |
| 574 | /** Txids of mempool transactions that this transaction directly conflicts with. */ |
| 575 | std::set<uint256> m_conflicts; |
| 576 | std::set<std::pair<uint256, COutPoint> > m_set_pegins_spent; |
| 577 | /** Iterators to mempool entries that this transaction directly conflicts with. */ |
| 578 | CTxMemPool::setEntries m_iters_conflicting; |
| 579 | /** Iterators to all mempool entries that would be replaced by this transaction, including |
| 580 | * those it directly conflicts with and their descendants. */ |
| 581 | CTxMemPool::setEntries m_all_conflicting; |
| 582 | /** All mempool ancestors of this transaction. */ |
| 583 | CTxMemPool::setEntries m_ancestors; |
| 584 | /** Mempool entry constructed for this transaction. Constructed in PreChecks() but not |
| 585 | * inserted into the mempool until Finalize(). */ |
| 586 | std::unique_ptr<CTxMemPoolEntry> m_entry; |
| 587 | /** Pointers to the transactions that have been removed from the mempool and replaced by |
| 588 | * this transaction, used to return to the MemPoolAccept caller. Only populated if |
| 589 | * validation is successful and the original transactions are removed. */ |
| 590 | std::list<CTransactionRef> m_replaced_transactions; |
| 591 | |
| 592 | /** Virtual size of the transaction as used by the mempool, calculated using serialized size |
| 593 | * of the transaction and sigops. */ |
| 594 | int64_t m_vsize; |
| 595 | /** Fees paid by this transaction: total input amounts subtracted by total output amounts. */ |
| 596 | CAmount m_base_fees; |
| 597 | /** Base fees + any fee delta set by the user with prioritisetransaction. */ |
| 598 | CAmount m_modified_fees; |
| 599 | /** Total modified fees of all transactions being replaced. */ |
| 600 | CAmount m_conflicting_fees{0}; |
| 601 | /** Total virtual size of all transactions being replaced. */ |
| 602 | size_t m_conflicting_size{0}; |
| 603 | |
| 604 | const CTransactionRef& m_ptx; |
| 605 | /** Txid. */ |
| 606 | const uint256& m_hash; |
| 607 | TxValidationState m_state; |
| 608 | /** A temporary cache containing serialized transaction data for signature verification. |
| 609 | * Reused across PolicyScriptChecks and ConsensusScriptChecks. */ |
| 610 | PrecomputedTransactionData m_precomputed_txdata; |
| 611 | }; |
| 612 | |
| 613 | // Run the policy checks on a given transaction, excluding any script checks. |
| 614 | // Looks up inputs, calculates feerate, considers replacement, evaluates |
no outgoing calls
no test coverage detected