mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "eth: conver if-else-if chain to tagged switch (#27816)"
This reverts commit 2fa03e1f92.
This commit is contained in:
parent
116216055f
commit
e5873d8002
1 changed files with 8 additions and 10 deletions
|
|
@ -62,14 +62,13 @@ func (api *DebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) {
|
||||||
return stateDb.RawDump(opts), nil
|
return stateDb.RawDump(opts), nil
|
||||||
}
|
}
|
||||||
var header *types.Header
|
var header *types.Header
|
||||||
switch blockNr {
|
if blockNr == rpc.LatestBlockNumber {
|
||||||
case rpc.LatestBlockNumber:
|
|
||||||
header = api.eth.blockchain.CurrentBlock()
|
header = api.eth.blockchain.CurrentBlock()
|
||||||
case rpc.FinalizedBlockNumber:
|
} else if blockNr == rpc.FinalizedBlockNumber {
|
||||||
header = api.eth.blockchain.CurrentFinalBlock()
|
header = api.eth.blockchain.CurrentFinalBlock()
|
||||||
case rpc.SafeBlockNumber:
|
} else if blockNr == rpc.SafeBlockNumber {
|
||||||
header = api.eth.blockchain.CurrentSafeBlock()
|
header = api.eth.blockchain.CurrentSafeBlock()
|
||||||
default:
|
} else {
|
||||||
block := api.eth.blockchain.GetBlockByNumber(uint64(blockNr))
|
block := api.eth.blockchain.GetBlockByNumber(uint64(blockNr))
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return state.Dump{}, fmt.Errorf("block #%d not found", blockNr)
|
return state.Dump{}, fmt.Errorf("block #%d not found", blockNr)
|
||||||
|
|
@ -147,14 +146,13 @@ func (api *DebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start hex
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var header *types.Header
|
var header *types.Header
|
||||||
switch number {
|
if number == rpc.LatestBlockNumber {
|
||||||
case rpc.LatestBlockNumber:
|
|
||||||
header = api.eth.blockchain.CurrentBlock()
|
header = api.eth.blockchain.CurrentBlock()
|
||||||
case rpc.FinalizedBlockNumber:
|
} else if number == rpc.FinalizedBlockNumber {
|
||||||
header = api.eth.blockchain.CurrentFinalBlock()
|
header = api.eth.blockchain.CurrentFinalBlock()
|
||||||
case rpc.SafeBlockNumber:
|
} else if number == rpc.SafeBlockNumber {
|
||||||
header = api.eth.blockchain.CurrentSafeBlock()
|
header = api.eth.blockchain.CurrentSafeBlock()
|
||||||
default:
|
} else {
|
||||||
block := api.eth.blockchain.GetBlockByNumber(uint64(number))
|
block := api.eth.blockchain.GetBlockByNumber(uint64(number))
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return state.IteratorDump{}, fmt.Errorf("block #%d not found", number)
|
return state.IteratorDump{}, fmt.Errorf("block #%d not found", number)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue