erigon-pulse/cmd/txpool
Mark Holt d8b91c4d02
Fix startup sync for txpool processing for bor block production (#9219)
When the sync loop first runs it suppresses block sync events both in
the initial loop and when the blocks being processed are greater than
1000.

This fix removed the first check, because otherwise the first block
received by the process ends up not getting sent to the tx pool. Which
means it won't produce new block for polygon.

As well as this fix - I have also moved the gas initialization to the
txpool start method rather than prompting it with a 'synthetic block
event'

As the txpool start has access to the core & tx DB's it can find the
current block and chain config internally so that it doesn't need to be
externally activated it can just do this itself on start up. This has
the advantage of making the txpool more self contained.
2024-01-13 10:33:34 +00:00
..
main.go Fix startup sync for txpool processing for bor block production (#9219) 2024-01-13 10:33:34 +00:00
readme.md txpool: update cli flags (#7282) 2023-04-08 06:52:04 +00:00

TxPool v2

Transaction Pool - place where living "not-included-to-block-yet transactions". Erigon's TxPool can work inside Erigon (default) and as separated process.

Erigon's pool implementation is not fork of Geths, has Apache license - Design docs: https://github.com/ledgerwatch/erigon/wiki/Transaction-Pool-Design 95% of pool-related code (from p2p message parsing, to sorting logic) is inside this folder: https://github.com/ledgerwatch/erigon-lib/tree/main/txpool

Internal mode

It's default. No special flags required - just start Erigon. RPCDaemon - flags --private.api.addr and --txpool.api.addr must have same value in this case.

External mode

make txpool

# Add `--txpool.disable` flag to Erigon

# External TxPool require(!) external Sentry
./build/bin/sentry --sentry.api.addr=localhost:9091 --datadir=<your_datadir>

# Start TxPool service (it connects to Erigon and Sentry):
# --private.api.addr - connect to Erigon's grpc api
# --sentry.api.addr  - connect to Sentry's grpc api
# --txpool.api.addr  - other services to connect TxPool's grpc api
# Increase limits flags: --txpool.globalslots, --txpool.globalbasefeeslots, --txpool.globalqueue
# --txpool.trace.senders - print more logs about Txs with senders in this list 
./build/bin/txpool --private.api.addr=localhost:9090 --sentry.api.addr=localhost:9091 --txpool.api.addr=localhost:9094 --datadir=<your_datadir>

# Add flag `--txpool.api.addr` to RPCDaemon  

ToDo list

[] Hard-forks support (now TxPool require restart - after hard-fork happens) [] Add pool to docker-compose [] Add pool (db table) - where store recently mined txs - for faster unwind/reorg. [] Save history of local transactions - with 1 day expiration [] move tx.rlp field to separated map, to make tx immutable