Skip to main content

accept_to_memory_pool

Function accept_to_memory_pool 

Source
pub fn accept_to_memory_pool(
    tx: &Transaction,
    witnesses: Option<&[Vec<Vec<u8>>]>,
    utxo_set: &HashMap<OutPoint, Arc<UTXO>, FxBuildHasher>,
    mempool: &HashSet<[u8; 32]>,
    height: u64,
    time_context: Option<TimeContext>,
) -> Result<MempoolResult, ConsensusError>
Expand description

Spec-locked to Orange Paper Section 9.1: AcceptToMemoryPool

AcceptToMemoryPool: ๐’ฏ๐’ณ ร— ๐’ฐ๐’ฎ โ†’ {accepted, rejected}

For transaction tx and UTXO set us:

  1. Check if tx is already in mempool
  2. Validate transaction structure
  3. Check inputs against UTXO set
  4. Verify scripts
  5. Check mempool-specific rules (size, fee rate, etc.)
  6. Check for conflicts with existing mempool transactions
  7. Return acceptance result

ยงArguments

  • tx - Transaction to validate
  • witnesses - Optional witness data for each input (Vec where Witness = Vec)
  • utxo_set - Current UTXO set
  • mempool - Current mempool state
  • height - Current block height
  • time_context - Time context with median time-past of chain tip (BIP113) for transaction finality check