mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/utils, core, eth/download: resolve txLookupLimit for db cmds
This commit is contained in:
parent
89ad90d335
commit
0180d5e1f6
3 changed files with 12 additions and 3 deletions
|
|
@ -1727,7 +1727,11 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
|
||||||
cache.TrieDirtyLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
|
cache.TrieDirtyLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
|
||||||
}
|
}
|
||||||
vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)}
|
vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)}
|
||||||
chain, err = core.NewBlockChain(chainDb, cache, config, engine, vmcfg, nil, 0)
|
txLookupLimit := uint64(0)
|
||||||
|
if ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
|
||||||
|
txLookupLimit = ctx.GlobalUint64(TxLookupLimitFlag.Name)
|
||||||
|
}
|
||||||
|
chain, err = core.NewBlockChain(chainDb, cache, config, engine, vmcfg, nil, txLookupLimit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Can't create BlockChain: %v", err)
|
Fatalf("Can't create BlockChain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2074,10 +2074,15 @@ func (bc *BlockChain) update() {
|
||||||
func (bc *BlockChain) maintainTxIndex() {
|
func (bc *BlockChain) maintainTxIndex() {
|
||||||
// initialiseIndices inits tx indices into the database if `TxIndexTail`
|
// initialiseIndices inits tx indices into the database if `TxIndexTail`
|
||||||
// is missing in database.
|
// is missing in database.
|
||||||
// Note for archive sync or fast sync, this code path will only be triggered
|
//
|
||||||
|
// Note for archive sync or full sync, this code path will only be triggered
|
||||||
// after importing the first batch of blocks(e.g. 1024). But these block
|
// after importing the first batch of blocks(e.g. 1024). But these block
|
||||||
// actually are already indexed. So a binary search will be performed to
|
// actually are already indexed. So a binary search will be performed to
|
||||||
// skip reindexing.
|
// skip reindexing.
|
||||||
|
//
|
||||||
|
// Besides for old node database which actually contains all indices but
|
||||||
|
// without `TxIndexTail` in database, binary search can also help to skip
|
||||||
|
// reindexing.
|
||||||
initialiseIndices := func(head uint64, done chan struct{}) {
|
initialiseIndices := func(head uint64, done chan struct{}) {
|
||||||
defer func() { done <- struct{}{} }()
|
defer func() { done <- struct{}{} }()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1721,7 +1721,7 @@ func (d *Downloader) commitPivotBlock(result *fetchResult) error {
|
||||||
if _, err := d.blockchain.InsertReceiptChain([]*types.Block{block}, []types.Receipts{result.Receipts}, d.ancientLimit); err != nil {
|
if _, err := d.blockchain.InsertReceiptChain([]*types.Block{block}, []types.Receipts{result.Receipts}, d.ancientLimit); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Use origin block number + 1 as the number of the first inserted block.
|
// Use origin block number + 1 as the first inserted block number
|
||||||
d.syncStatsLock.RLock()
|
d.syncStatsLock.RLock()
|
||||||
from := d.syncStatsChainOrigin + 1
|
from := d.syncStatsChainOrigin + 1
|
||||||
d.syncStatsLock.RUnlock()
|
d.syncStatsLock.RUnlock()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue