You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The mempool of a node holds a set of transactions.
Each transaction has a cost, which is an integer defined as: max(serialized transaction size in bytes, 4000)
Each transaction also has an eviction weight, which is cost + low_fee_penalty,
where low_fee_penalty is 16000 if the transaction pays a fee less than the conventional fee, otherwise 0. The conventional fee is currently defined as 1000 zatoshis.
Each node also MUST hold a FIFO queue RecentlyEvicted of pairs (txid, time), where the time indicates when the transaction with the given txid was evicted. The txid (rather than the wtxid ...) is used even for version 5 transactions after activation of NU5.
On receiving a transaction:
If it is in RecentlyEvicted, the transaction MUST be dropped.
Calculate its cost. If the total cost of transactions in the mempool including this one would exceed mempooltxcostlimit, then the node MUST repeatedly call EvictTransaction (with the new transaction included as a candidate to evict) until the total cost does not exceed mempooltxcostlimit.
EvictTransaction MUST do the following:
Select a random transaction to evict, with probability in direct proportion to eviction weight.
Add the txid and the current time to RecentlyEvicted ...
Remove [the randomly selected transaction] from the mempool.
Motivation
ZIP-401 specifies weighted random mempool transaction evictions:
https://zips.z.cash/zip-0401#specification
This Ticket Depends On
match by
txid
notwtxid
:serialized transaction size in bytes
:UnminedTx
#2778transaction fee:
verify_transparent_inputs_and_outputs
#2440Consensus Rules
https://zips.z.cash/zip-0401#specification
Design
rand::distributions::weighted::WeightedIndex is a weighted random implementation from a very popular crate.
It supports any collection type with continuous integer indexes. (Like
Vec
orVecDeque
.)The text was updated successfully, but these errors were encountered: