Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
4326061e
Commit
4326061e
authored
Mar 31, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: fix accidental nil panic on nil errors
parent
6c670eff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
api.go
eth/api.go
+13
-4
No files found.
eth/api.go
View file @
4326061e
...
@@ -1531,7 +1531,7 @@ func (api *PrivateDebugAPI) TraceBlock(blockRlp []byte, config vm.Config) BlockT
...
@@ -1531,7 +1531,7 @@ func (api *PrivateDebugAPI) TraceBlock(blockRlp []byte, config vm.Config) BlockT
return
BlockTraceResult
{
return
BlockTraceResult
{
Validated
:
validated
,
Validated
:
validated
,
StructLogs
:
formatLogs
(
logs
),
StructLogs
:
formatLogs
(
logs
),
Error
:
err
.
Error
(
),
Error
:
formatError
(
err
),
}
}
}
}
...
@@ -1557,7 +1557,7 @@ func (api *PrivateDebugAPI) TraceBlockByNumber(number uint64, config vm.Config)
...
@@ -1557,7 +1557,7 @@ func (api *PrivateDebugAPI) TraceBlockByNumber(number uint64, config vm.Config)
return
BlockTraceResult
{
return
BlockTraceResult
{
Validated
:
validated
,
Validated
:
validated
,
StructLogs
:
formatLogs
(
logs
),
StructLogs
:
formatLogs
(
logs
),
Error
:
err
.
Error
(
),
Error
:
formatError
(
err
),
}
}
}
}
...
@@ -1573,7 +1573,7 @@ func (api *PrivateDebugAPI) TraceBlockByHash(hash common.Hash, config vm.Config)
...
@@ -1573,7 +1573,7 @@ func (api *PrivateDebugAPI) TraceBlockByHash(hash common.Hash, config vm.Config)
return
BlockTraceResult
{
return
BlockTraceResult
{
Validated
:
validated
,
Validated
:
validated
,
StructLogs
:
formatLogs
(
logs
),
StructLogs
:
formatLogs
(
logs
),
Error
:
err
.
Error
(
),
Error
:
formatError
(
err
),
}
}
}
}
...
@@ -1666,7 +1666,7 @@ func formatLogs(structLogs []vm.StructLog) []structLogRes {
...
@@ -1666,7 +1666,7 @@ func formatLogs(structLogs []vm.StructLog) []structLogRes {
Gas
:
trace
.
Gas
,
Gas
:
trace
.
Gas
,
GasCost
:
trace
.
GasCost
,
GasCost
:
trace
.
GasCost
,
Depth
:
trace
.
Depth
,
Depth
:
trace
.
Depth
,
Error
:
trace
.
Err
.
Error
(
),
Error
:
formatError
(
trace
.
Err
),
Stack
:
make
([]
string
,
len
(
trace
.
Stack
)),
Stack
:
make
([]
string
,
len
(
trace
.
Stack
)),
Storage
:
make
(
map
[
string
]
string
),
Storage
:
make
(
map
[
string
]
string
),
}
}
...
@@ -1686,6 +1686,15 @@ func formatLogs(structLogs []vm.StructLog) []structLogRes {
...
@@ -1686,6 +1686,15 @@ func formatLogs(structLogs []vm.StructLog) []structLogRes {
return
formattedStructLogs
return
formattedStructLogs
}
}
// formatError formats a Go error into either an empty string or the data content
// of the error itself.
func
formatError
(
err
error
)
string
{
if
err
==
nil
{
return
""
}
return
err
.
Error
()
}
// TraceTransaction returns the structured logs created during the execution of EVM
// TraceTransaction returns the structured logs created during the execution of EVM
// and returns them as a JSON object.
// and returns them as a JSON object.
func
(
s
*
PrivateDebugAPI
)
TraceTransaction
(
txHash
common
.
Hash
,
logger
vm
.
LogConfig
)
(
*
ExecutionResult
,
error
)
{
func
(
s
*
PrivateDebugAPI
)
TraceTransaction
(
txHash
common
.
Hash
,
logger
vm
.
LogConfig
)
(
*
ExecutionResult
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment