good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
876ce0fb
Commit
876ce0fb
authored
Apr 2, 2015
by
Taylor Gerring
Browse files
Options
Downloads
Patches
Plain Diff
More nil checks
parent
172b3435
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rpc/api.go
+6
-0
6 additions, 0 deletions
rpc/api.go
rpc/responses.go
+4
-2
4 additions, 2 deletions
rpc/responses.go
with
10 additions
and
2 deletions
rpc/api.go
+
6
−
0
View file @
876ce0fb
...
@@ -212,6 +212,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -212,6 +212,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
block
:=
api
.
xeth
()
.
EthBlockByHash
(
args
.
Hash
)
block
:=
api
.
xeth
()
.
EthBlockByHash
(
args
.
Hash
)
br
:=
NewBlockRes
(
block
,
true
)
br
:=
NewBlockRes
(
block
,
true
)
if
br
==
nil
{
*
reply
=
nil
}
if
args
.
Index
>=
int64
(
len
(
br
.
Transactions
))
||
args
.
Index
<
0
{
if
args
.
Index
>=
int64
(
len
(
br
.
Transactions
))
||
args
.
Index
<
0
{
return
NewValidationError
(
"Index"
,
"does not exist"
)
return
NewValidationError
(
"Index"
,
"does not exist"
)
...
@@ -225,6 +228,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -225,6 +228,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
block
:=
api
.
xeth
()
.
EthBlockByNumber
(
args
.
BlockNumber
)
block
:=
api
.
xeth
()
.
EthBlockByNumber
(
args
.
BlockNumber
)
v
:=
NewBlockRes
(
block
,
true
)
v
:=
NewBlockRes
(
block
,
true
)
if
v
==
nil
{
*
reply
=
nil
}
if
args
.
Index
>=
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
if
args
.
Index
>=
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
return
NewValidationError
(
"Index"
,
"does not exist"
)
return
NewValidationError
(
"Index"
,
"does not exist"
)
...
...
This diff is collapsed.
Click to expand it.
rpc/responses.go
+
4
−
2
View file @
876ce0fb
...
@@ -125,8 +125,6 @@ func (b *BlockRes) MarshalJSON() ([]byte, error) {
...
@@ -125,8 +125,6 @@ func (b *BlockRes) MarshalJSON() ([]byte, error) {
}
}
func
NewBlockRes
(
block
*
types
.
Block
,
fullTx
bool
)
*
BlockRes
{
func
NewBlockRes
(
block
*
types
.
Block
,
fullTx
bool
)
*
BlockRes
{
// TODO respect fullTx flag
if
block
==
nil
{
if
block
==
nil
{
return
nil
return
nil
}
}
...
@@ -182,6 +180,10 @@ type TransactionRes struct {
...
@@ -182,6 +180,10 @@ type TransactionRes struct {
}
}
func
NewTransactionRes
(
tx
*
types
.
Transaction
)
*
TransactionRes
{
func
NewTransactionRes
(
tx
*
types
.
Transaction
)
*
TransactionRes
{
if
tx
==
nil
{
return
nil
}
var
v
=
new
(
TransactionRes
)
var
v
=
new
(
TransactionRes
)
v
.
Hash
=
newHexData
(
tx
.
Hash
())
v
.
Hash
=
newHexData
(
tx
.
Hash
())
v
.
Nonce
=
newHexNum
(
tx
.
Nonce
())
v
.
Nonce
=
newHexNum
(
tx
.
Nonce
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment