Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions core/txindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,30 @@ func (indexer *txIndexer) loop(chain *BlockChain) {

// Listening to chain events and manipulate the transaction indexes.
var (
stop chan struct{} // Non-nil if background routine is active.
done chan struct{} // Non-nil if background routine is active.
lastHead uint64 // The latest announced chain head (whose tx indexes are assumed created)
lastTail = rawdb.ReadTxIndexTail(indexer.db) // The oldest indexed block, nil means nothing indexed

headCh = make(chan ChainHeadEvent)
sub = chain.SubscribeChainHeadEvent(headCh)
stop chan struct{} // Non-nil if background routine is active.
done chan struct{} // Non-nil if background routine is active.
lastHead uint64 // The latest announced chain head (whose tx indexes are assumed created)
headCh = make(chan ChainHeadEvent)
sub = chain.SubscribeChainHeadEvent(headCh)
)

lastTail := rawdb.ReadTxIndexTail(indexer.db)
if lastTail != nil {
// NOTE: The "TransactionIndexTail" key may exist only in cold SST files.
// Without a recent write, the key won't be in the memtable or block cache,
// causing every Get to trigger expensive readBlock + CRC checks.
//
// This dummy write forces the key into the memtable (and later SST),
// ensuring future reads are fast (from memory or block cache).
batch := indexer.db.NewBatch()
rawdb.WriteTxIndexTail(batch, *lastTail)

if err := batch.Write(); err != nil {
log.Crit("Failed to write TransactionIndexTail warm-up", "error", err)
return
}
}

defer sub.Unsubscribe()

// Launch the initial processing if chain is not empty (head != genesis).
Expand Down
2 changes: 1 addition & 1 deletion eth/fetcher/block_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ func (f *BlockFetcher) loop() {
}
case entry := <-f.quickBlockFetchingCh:
annHash := entry.announce.hash
// if there is error or timeout, and the shcedule have not started, just retry the fetch
// if there is error or timeout, and the schedule have not started, just retry the fetch
if entry.err != nil {
quickBlockFetchingErrMeter.Mark(1)
log.Debug("Quick block fetching err", "hash", annHash, "err", entry.err)
Expand Down
2 changes: 1 addition & 1 deletion eth/peerset.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func (ps *peerSet) peersWithoutBlock(hash common.Hash) []*ethPeer {
list = append(list, p)
}
}
log.Debug("get peers without block", "hash", hash, "total", len(ps.peers), "unknonw", len(list))
log.Debug("get peers without block", "hash", hash, "total", len(ps.peers), "unknown", len(list))
return list
}

Expand Down
2 changes: 1 addition & 1 deletion eth/protocols/snap/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const (
minTrienodeHealThrottle = 1

// maxTrienodeHealThrottle is the maximum divisor for throttling trie node
// heal requests to avoid overloading the local node and exessively expanding
// heal requests to avoid overloading the local node and excessively expanding
// the state trie bedth wise.
maxTrienodeHealThrottle = maxTrieRequestCount

Expand Down
2 changes: 1 addition & 1 deletion miner/ordering.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func newTransactionsByPriceAndNonce(signer types.Signer, txs map[common.Address]
}
}

// Copy copys a new TransactionsPriceAndNonce with the same *transaction
// Copy copies a new TransactionsPriceAndNonce with the same *transaction
func (t *transactionsByPriceAndNonce) Copy() *transactionsByPriceAndNonce {
heads := make([]*txWithMinerFee, len(t.heads))
copy(heads, t.heads)
Expand Down
2 changes: 1 addition & 1 deletion node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (n *Node) apis() []rpc.API {
}

// adminAPI is the collection of administrative API methods exposed over
// both secure and unsecure RPC channels.
// both secure and insecure RPC channels.
type adminAPI struct {
node *Node // Node interfaced by this API
}
Expand Down