Skip to content

Commit

Permalink
historysegment: add testnet&mainnet hard code;
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbundler committed Dec 8, 2023
1 parent 080828f commit ab5374e
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 34 deletions.
25 changes: 12 additions & 13 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,19 +736,18 @@ func exportSegment(ctx *cli.Context) error {
boundStartBlock = params.BoundStartBlock
historySegmentLength = params.HistorySegmentLength
)
// TODO(0xbundler): for testing
//switch genesisHash {
//case params.BSCGenesisHash, params.ChapelGenesisHash, params.RialtoGenesisHash:
// boundStartBlock = params.BoundStartBlock
// historySegmentLength = params.HistorySegmentLength
//default:
if ctx.IsSet(utils.BoundStartBlockFlag.Name) {
boundStartBlock = ctx.Uint64(utils.BoundStartBlockFlag.Name)
}
if ctx.IsSet(utils.HistorySegmentLengthFlag.Name) {
historySegmentLength = ctx.Uint64(utils.HistorySegmentLengthFlag.Name)
}
//}
switch genesisHash {
case params.BSCGenesisHash, params.ChapelGenesisHash, params.RialtoGenesisHash:
boundStartBlock = params.BoundStartBlock
historySegmentLength = params.HistorySegmentLength
default:
if ctx.IsSet(utils.BoundStartBlockFlag.Name) {
boundStartBlock = ctx.Uint64(utils.BoundStartBlockFlag.Name)
}
if ctx.IsSet(utils.HistorySegmentLengthFlag.Name) {
historySegmentLength = ctx.Uint64(utils.HistorySegmentLengthFlag.Name)
}
}
if boundStartBlock == 0 || historySegmentLength == 0 {
return fmt.Errorf("wrong params, boundStartBlock: %v, historySegmentLength: %v", boundStartBlock, historySegmentLength)
}
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (db *nofreezedb) AncientDatadir() (string, error) {
}

func (db *nofreezedb) AncientReset(tail, head uint64) error {
return errNotSupported
return nil
}

// NewDatabase creates a high level database on top of a given key-value data
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/prunedfreezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (f *prunedfreezer) TruncateTail(tail uint64) (uint64, error) {
}

func (f *prunedfreezer) AncientReset(tail, head uint64) error {
return errNotSupported
return nil
}

// Sync flushes meta data tables to disk.
Expand Down
Loading

0 comments on commit ab5374e

Please sign in to comment.