aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ruminer <michael.ruminer+github@gmail.com>2017-12-10 06:47:13 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-10 06:47:13 +0800
commit732f5468d33ae184dfa518fb75b9da87efeee940 (patch)
treebf03fc298ee62c1ed43ecdb2583ac961b0ba5dfc
parentbbfe0b8d040728b4f6a40de0480301b4b5f3c9e2 (diff)
downloadgo-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar.gz
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar.bz2
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar.lz
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar.xz
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.tar.zst
go-tangerine-732f5468d33ae184dfa518fb75b9da87efeee940.zip
eth: make tracing API errors more user friendly (#15589)
-rw-r--r--eth/api.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/eth/api.go b/eth/api.go
index a907c3649..c748f75de 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -452,7 +452,12 @@ func (api *PrivateDebugAPI) traceBlock(block *types.Block, logConfig *vm.LogConf
}
statedb, err := blockchain.StateAt(blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1).Root())
if err != nil {
- return false, structLogger.StructLogs(), err
+ switch err.(type) {
+ case *trie.MissingNodeError:
+ return false, structLogger.StructLogs(), fmt.Errorf("required historical state unavailable")
+ default:
+ return false, structLogger.StructLogs(), err
+ }
}
receipts, _, usedGas, err := processor.Process(block, statedb, config)
@@ -518,7 +523,12 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common.
}
msg, context, statedb, err := api.computeTxEnv(blockHash, int(txIndex))
if err != nil {
- return nil, err
+ switch err.(type) {
+ case *trie.MissingNodeError:
+ return nil, fmt.Errorf("required historical state unavailable")
+ default:
+ return nil, err
+ }
}
// Run the transaction with tracing enabled.