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
5da7ec7c
Commit
5da7ec7c
authored
Jan 27, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd, eth, rpc: fix some RPC issues with pending blocks
parent
a8fd0de0
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
114 deletions
+107
-114
main.go
cmd/gethrpctest/main.go
+4
-0
api.go
eth/api.go
+94
-104
api.go
eth/filters/api.go
+2
-2
server.go
rpc/server.go
+0
-2
types.go
rpc/types.go
+7
-6
No files found.
cmd/gethrpctest/main.go
View file @
5da7ec7c
...
...
@@ -52,6 +52,10 @@ var (
func
main
()
{
flag
.
Parse
()
// Enable logging errors, we really do want to see those
glog
.
SetV
(
2
)
glog
.
SetToStderr
(
true
)
// Load the test suite to run the RPC against
tests
,
err
:=
tests
.
LoadBlockTests
(
*
testFile
)
if
err
!=
nil
{
...
...
eth/api.go
View file @
5da7ec7c
This diff is collapsed.
Click to expand it.
eth/filters/api.go
View file @
5da7ec7c
...
...
@@ -239,13 +239,13 @@ func (args *NewFilterArgs) UnmarshalJSON(data []byte) error {
return
err
}
if
raw
.
From
==
nil
{
if
raw
.
From
==
nil
||
raw
.
From
.
Int64
()
<
0
{
args
.
FromBlock
=
rpc
.
LatestBlockNumber
}
else
{
args
.
FromBlock
=
*
raw
.
From
}
if
raw
.
ToBlock
==
nil
{
if
raw
.
ToBlock
==
nil
||
raw
.
ToBlock
.
Int64
()
<
0
{
args
.
ToBlock
=
rpc
.
LatestBlockNumber
}
else
{
args
.
ToBlock
=
*
raw
.
ToBlock
...
...
rpc/server.go
View file @
5da7ec7c
...
...
@@ -332,7 +332,6 @@ func (s *Server) handle(ctx context.Context, codec ServerCodec, req *serverReque
return
res
}
}
return
codec
.
CreateResponse
(
req
.
id
,
reply
[
0
]
.
Interface
())
}
...
...
@@ -344,7 +343,6 @@ func (s *Server) exec(ctx context.Context, codec ServerCodec, req *serverRequest
}
else
{
response
=
s
.
handle
(
ctx
,
codec
,
req
)
}
if
err
:=
codec
.
Write
(
response
);
err
!=
nil
{
glog
.
V
(
logger
.
Error
)
.
Infof
(
"%v
\n
"
,
err
)
codec
.
Close
()
...
...
rpc/types.go
View file @
5da7ec7c
...
...
@@ -174,12 +174,14 @@ type HexNumber big.Int
// NewHexNumber creates a new hex number instance which will serialize the given val with `%#x` on marshal.
func
NewHexNumber
(
val
interface
{})
*
HexNumber
{
if
val
==
nil
{
return
nil
return
nil
// note, this doesn't catch nil pointers, only passing nil directly!
}
if
v
,
ok
:=
val
.
(
*
big
.
Int
);
ok
&&
v
!=
nil
{
hn
:=
new
(
big
.
Int
)
.
Set
(
v
)
return
(
*
HexNumber
)(
hn
)
if
v
,
ok
:=
val
.
(
*
big
.
Int
);
ok
{
if
v
!=
nil
{
return
(
*
HexNumber
)(
new
(
big
.
Int
)
.
Set
(
v
))
}
return
nil
}
rval
:=
reflect
.
ValueOf
(
val
)
...
...
@@ -303,10 +305,9 @@ const (
)
// UnmarshalJSON parses the given JSON fragement into a BlockNumber. It supports:
// - "latest"
or "earliest
" as string arguments
// - "latest"
, "earliest" or "pending
" as string arguments
// - the block number
// Returned errors:
// - an unsupported error when "pending" is specified (not yet implemented)
// - an invalid block number error when the given argument isn't a known strings
// - an out of range error when the given block number is either too little or too large
func
(
bn
*
BlockNumber
)
UnmarshalJSON
(
data
[]
byte
)
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