Page MenuHomePhabricator

[Chronik] Add `Mempool`, make `/tx/:txid` return mempool txs
ClosedPublic

Authored by tobias_ruck on Mar 25 2023, 23:20.

Details

Summary

We store everything we need to index the mempool in the Mempool struct.

Currently, we redundantly store all the mempool txs again, but this reduces implementation complexity. Once RAM usage becomes an issue, we can make sure we re-use the node's mempool.

To get a mempool tx, we add bridge_tx, which finds the spent coins for us and builds a ffi::Tx.

make_chronik_block now sets the time_first_seen of the mempool.

Depends on D13467.

Test Plan

ninja check-crates && ninja && ./test/functional/test_runner.py chronik_tx

Diff Detail

Event Timeline

chronik/chronik-cpp/chronik_validationinterface.cpp
35 ↗(On Diff #38900)

You can just pass info here

chronik/chronik-lib/src/bridge.rs
126 ↗(On Diff #38900)

what happens if bridge_tx throws ?

Add test whether conflicted tx actually gets removed from mempool

This revision is now accepted and ready to land.Mar 27 2023, 14:42