Struct bitcoin_indexed_chain::MemPoolAccept
source · pub struct MemPoolAccept { /* private fields */ }Implementations§
source§impl MemPoolAccept
impl MemPoolAccept
pub fn new(mempool: &mut TxMemPool, active_chainstate: &mut ChainState) -> Self
sourcepub fn check_fee_rate(
&mut self,
package_size: usize,
package_fee: Amount,
state: &mut TxValidationState
) -> bool
pub fn check_fee_rate( &mut self, package_size: usize, package_fee: Amount, state: &mut TxValidationState ) -> bool
| Compare a package’s feerate against | minimum allowed. |
sourcepub fn pre_checks(
&mut self,
args: &mut MemPoolAcceptATMPArgs,
ws: &mut MemPoolAcceptWorkspace
) -> bool
pub fn pre_checks( &mut self, args: &mut MemPoolAcceptATMPArgs, ws: &mut MemPoolAcceptWorkspace ) -> bool
| Run the policy checks on a given | transaction, excluding any script checks. | | Looks up inputs, calculates feerate, | considers replacement, evaluates package | limits, etc. As this function can be | invoked for “free” by a peer, only tests | that are fast should be done here (to avoid | CPU DoS).
sourcepub fn policy_script_checks(
&mut self,
args: &MemPoolAcceptATMPArgs,
ws: &mut MemPoolAcceptWorkspace,
txdata: &mut PrecomputedTransactionData
) -> bool
pub fn policy_script_checks( &mut self, args: &MemPoolAcceptATMPArgs, ws: &mut MemPoolAcceptWorkspace, txdata: &mut PrecomputedTransactionData ) -> bool
| Run the script checks using our policy | flags. As this can be slow, we should only | invoke this on transactions that have | otherwise passed policy checks.
sourcepub fn consensus_script_checks(
&mut self,
args: &MemPoolAcceptATMPArgs,
ws: &mut MemPoolAcceptWorkspace,
txdata: &mut PrecomputedTransactionData
) -> bool
pub fn consensus_script_checks( &mut self, args: &MemPoolAcceptATMPArgs, ws: &mut MemPoolAcceptWorkspace, txdata: &mut PrecomputedTransactionData ) -> bool
| Re-run the script checks, using consensus | flags, and try to cache the result in the | scriptcache. This should be done after | PolicyScriptChecks(). This requires that | all inputs either be in our utxo set or in | the mempool.
sourcepub fn finalize(
&mut self,
args: &MemPoolAcceptATMPArgs,
ws: &mut MemPoolAcceptWorkspace
) -> bool
pub fn finalize( &mut self, args: &MemPoolAcceptATMPArgs, ws: &mut MemPoolAcceptWorkspace ) -> bool
| Try to add the transaction to the mempool, | removing any conflicts first. | | Returns true if the transaction is in the | mempool after any size limiting is | performed, false otherwise.
sourcepub fn accept_single_transaction(
&mut self,
ptx: &TransactionRef,
args: &mut MemPoolAcceptATMPArgs
) -> MempoolAcceptResult
pub fn accept_single_transaction( &mut self, ptx: &TransactionRef, args: &mut MemPoolAcceptATMPArgs ) -> MempoolAcceptResult
| Single transaction acceptance |
sourcepub fn accept_multiple_transactions(
&mut self,
txns: &Vec<TransactionRef>,
args: &mut MemPoolAcceptATMPArgs
) -> PackageMempoolAcceptResult
pub fn accept_multiple_transactions( &mut self, txns: &Vec<TransactionRef>, args: &mut MemPoolAcceptATMPArgs ) -> PackageMempoolAcceptResult
| Multiple transaction acceptance. | Transactions may or may not be interdependent, | but must not conflict with each other. | Parents must come before children if | any dependencies exist. |