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
5707912e
Commit
5707912e
authored
Mar 23, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"pending" convention should be -2 instead of 0
parent
2f8601ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
args.go
rpc/args.go
+1
-1
xeth.go
xeth/xeth.go
+14
-1
No files found.
rpc/args.go
View file @
5707912e
...
...
@@ -26,7 +26,7 @@ func blockHeight(raw interface{}, number *int64) (err error) {
case
"latest"
:
*
number
=
-
1
case
"pending"
:
*
number
=
0
*
number
=
-
2
default
:
*
number
=
common
.
String2Big
(
str
)
.
Int64
()
}
...
...
xeth/xeth.go
View file @
5707912e
...
...
@@ -176,9 +176,12 @@ func (self *XEth) AtStateNum(num int64) *XEth {
chain
:=
self
.
Backend
()
.
ChainManager
()
var
block
*
types
.
Block
// -1 generally means "latest"
// -2 means "pending", which has no blocknum
if
num
<
0
{
num
=
chain
.
CurrentBlock
()
.
Number
()
.
Int64
()
+
num
+
1
num
=
chain
.
CurrentBlock
()
.
Number
()
.
Int64
()
}
block
=
chain
.
GetBlockByNumber
(
uint64
(
num
))
var
st
*
state
.
StateDB
...
...
@@ -229,6 +232,11 @@ func (self *XEth) EthTransactionByHash(hash string) *types.Transaction {
}
func
(
self
*
XEth
)
BlockByNumber
(
num
int64
)
*
Block
{
if
num
==
-
2
{
// "pending" is non-existant
return
&
Block
{}
}
if
num
==
-
1
{
return
NewBlock
(
self
.
chainManager
.
CurrentBlock
())
}
...
...
@@ -237,6 +245,11 @@ func (self *XEth) BlockByNumber(num int64) *Block {
}
func
(
self
*
XEth
)
EthBlockByNumber
(
num
int64
)
*
types
.
Block
{
if
num
==
-
2
{
// "pending" is non-existant
return
&
types
.
Block
{}
}
if
num
==
-
1
{
return
self
.
chainManager
.
CurrentBlock
()
}
...
...
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