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:
- Check if tx is already in mempool
- Validate transaction structure
- Check inputs against UTXO set
- Verify scripts
- Check mempool-specific rules (size, fee rate, etc.)
- Check for conflicts with existing mempool transactions
- Return acceptance result
ยงArguments
tx- Transaction to validatewitnesses- Optional witness data for each input (Vecwhere Witness = Vec ) utxo_set- Current UTXO setmempool- Current mempool stateheight- Current block heighttime_context- Time context with median time-past of chain tip (BIP113) for transaction finality check