Skip to content

Commit b9b99a1

Browse files
authored
eth: abort on api operations not available in pbss-mode (#28104)
eth: abort on api calls not supporting pbss
1 parent eb74389 commit b9b99a1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

eth/api_debug.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ func (api *DebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]c
362362
// The (from, to) parameters are the sequence of blocks to search, which can go
363363
// either forwards or backwards
364364
func (api *DebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64, error) {
365+
if api.eth.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
366+
return 0, errors.New("state history is not yet available in path-based scheme")
367+
}
365368
db := api.eth.ChainDb()
366369
var pivot uint64
367370
if p := rawdb.ReadLastPivotNumber(db); p != nil {
@@ -422,6 +425,9 @@ func (api *DebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64, error
422425
// If the value is shorter than the block generation time, or even 0 or negative,
423426
// the node will flush trie after processing each block (effectively archive mode).
424427
func (api *DebugAPI) SetTrieFlushInterval(interval string) error {
428+
if api.eth.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
429+
return errors.New("trie flush interval is undefined for path-based scheme")
430+
}
425431
t, err := time.ParseDuration(interval)
426432
if err != nil {
427433
return err
@@ -431,6 +437,9 @@ func (api *DebugAPI) SetTrieFlushInterval(interval string) error {
431437
}
432438

433439
// GetTrieFlushInterval gets the current value of in-memory trie flush interval
434-
func (api *DebugAPI) GetTrieFlushInterval() string {
435-
return api.eth.blockchain.GetTrieFlushInterval().String()
440+
func (api *DebugAPI) GetTrieFlushInterval() (string, error) {
441+
if api.eth.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
442+
return "", errors.New("trie flush interval is undefined for path-based scheme")
443+
}
444+
return api.eth.blockchain.GetTrieFlushInterval().String(), nil
436445
}

0 commit comments

Comments
 (0)