libbitcoin/libbitcoin-blockchain

Add configurable mempool timeout policy.

Closed this issue · 2 comments

If the network is flooded with activity, unconfirmed transactions may be dropped in a few hours, but it the network is slow, it may be days. ... Is there any way to configure the mempool based on a timeout, so any transaction over X hours old will be dropped? - @swansontec

It would consist of a deadline timer on the tx pool, timeout config setting, per entry time stamp, and thread safe pool scan/update on timeout, with timer reinitialization.

Considering the movement of the transaction pool from memory to disk (in the tx store), I'd question why we would ever drop a valid transaction assuming it initially met the node's minimum fee policy.

Such transactions are mine-able and therefore useful indefinitely. For a mining node this can increase profitability. Even if an unmined transaction's prevouts become spent by a mined transaction a reorganization can reverse this outcome. Valid unmined transactions are fundamentally part of the chain, just with the weakest assurance.

Like anything else that has been stored but remains valid, loss would be a pruning measure more generally applied. Currently libbitcoin implements no pruning features, although rebuilding the store is fast and effective. It is potentially faster than pruning from an existing store and doesn't not require a duplication of disk space in the interim.

Closing this issue as the feature is in conflict with design goals for 4.0, which is to retain all transactions until they are mined or cannot be mined (due to requiring a reorg deeper than configuration allows).