-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/utils, eth/ethconfig: unindex txs older than ~1 year #22293
Conversation
cmd/utils/flags.go
Outdated
Name: "txlookuplimit", | ||
Usage: "Number of recent blocks to maintain transactions index by-hash for (default = index all blocks)", | ||
Value: 0, | ||
Usage: "Number of recent blocks to maintain transactions index by-hash for (default = index about one year)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 0
mean infinity
? Might need a clarification in the Usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's no way to say infinity in Go, so 0 is kind of "disable"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but 0
, for a uint-flag, might to the user mean "Don't index anything". And if the user sets 0
with that notion, it's bad UX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatives:
- keep it as a
int
flag, and make-1
mean "everything" - Add to teh Usage string:
(default = index about one year, 0 = index everything)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with the 2nd suggestion
7a0fd9f
to
409b16e
Compare
https://twitter.com/peter_szilagyi/status/1358767100995784704 .
This PR changes the default number of indexed transaction from infinite to the most recent 1 year (assuming block times of around 13-14s).
The reasoning behind this change is that currently on mainnet there are over 1 billion transactions. Just tracking the
hash->blocknum
mapping weighs 33GB on the database (requires SSD speeds due to the hash keying) and represents 3/5th of the database entry count, which makes trie operations and compactions exceedingly expensive.Without any form of pruning, the transaction index dataset grows indefinitely. We must bite the bullet and have normal full nodes retain meaningful history, but not indefinite.
Operators still wishing to index all transactions since genesis can run geth with
--txlookuplimit=0
. The index can be reconstructed even if it was pruned, so no data is lost. The index is not needed for network health, it's just a local acceleration structure.-