core, core/rawdb, eth/sync: no tx indexing during snap sync (#28703)
This change simplifies the logic for indexing transactions and enhances the UX when transaction is not found by returning more information to users. Transaction indexing is now considered as a part of the initial sync, and `eth.syncing` will thus be `true` if transaction indexing is not yet finished. API consumers can use the syncing status to determine if the node is ready to serve users.
This commit is contained in:
@@ -120,6 +120,18 @@ type SyncProgress struct {
|
||||
|
||||
HealingTrienodes uint64 // Number of state trie nodes pending
|
||||
HealingBytecode uint64 // Number of bytecodes pending
|
||||
|
||||
// "transaction indexing" fields
|
||||
TxIndexFinishedBlocks uint64 // Number of blocks whose transactions are already indexed
|
||||
TxIndexRemainingBlocks uint64 // Number of blocks whose transactions are not indexed yet
|
||||
}
|
||||
|
||||
// Done returns the indicator if the initial sync is finished or not.
|
||||
func (prog SyncProgress) Done() bool {
|
||||
if prog.CurrentBlock < prog.HighestBlock {
|
||||
return false
|
||||
}
|
||||
return prog.TxIndexRemainingBlocks == 0
|
||||
}
|
||||
|
||||
// ChainSyncReader wraps access to the node's current sync status. If there's no
|
||||
|
||||
Reference in New Issue
Block a user