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
00787fe7
Commit
00787fe7
authored
8 years ago
by
zsfelfoldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: added CheckNonce() to Message interface
parent
2b94d7fc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
8 deletions
+17
-8
simulated.go
accounts/abi/bind/backends/simulated.go
+2
-1
api.go
common/registrar/ethreg/api.go
+4
-1
state_transition.go
core/state_transition.go
+5
-2
transaction.go
core/types/transaction.go
+1
-0
api.go
eth/api.go
+2
-2
api.go
internal/ethapi/api.go
+2
-2
util.go
tests/util.go
+1
-0
No files found.
accounts/abi/bind/backends/simulated.go
View file @
00787fe7
...
...
@@ -203,7 +203,8 @@ type callmsg struct {
func
(
m
callmsg
)
From
()
(
common
.
Address
,
error
)
{
return
m
.
from
.
Address
(),
nil
}
func
(
m
callmsg
)
FromFrontier
()
(
common
.
Address
,
error
)
{
return
m
.
from
.
Address
(),
nil
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
m
.
from
.
Nonce
()
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
0
}
func
(
m
callmsg
)
CheckNonce
()
bool
{
return
false
}
func
(
m
callmsg
)
To
()
*
common
.
Address
{
return
m
.
to
}
func
(
m
callmsg
)
GasPrice
()
*
big
.
Int
{
return
m
.
gasPrice
}
func
(
m
callmsg
)
Gas
()
*
big
.
Int
{
return
m
.
gasLimit
}
...
...
This diff is collapsed.
Click to expand it.
common/registrar/ethreg/api.go
View file @
00787fe7
...
...
@@ -128,7 +128,10 @@ func (m callmsg) FromFrontier() (common.Address, error) {
return
m
.
from
.
Address
(),
nil
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
m
.
from
.
Nonce
()
return
0
}
func
(
m
callmsg
)
CheckNonce
()
bool
{
return
false
}
func
(
m
callmsg
)
To
()
*
common
.
Address
{
return
m
.
to
...
...
This diff is collapsed.
Click to expand it.
core/state_transition.go
View file @
00787fe7
...
...
@@ -71,6 +71,7 @@ type Message interface {
Value
()
*
big
.
Int
Nonce
()
uint64
CheckNonce
()
bool
Data
()
[]
byte
}
...
...
@@ -208,8 +209,10 @@ func (self *StateTransition) preCheck() (err error) {
}
// Make sure this transaction's nonce is correct
if
n
:=
self
.
state
.
GetNonce
(
sender
.
Address
());
n
!=
msg
.
Nonce
()
{
return
NonceError
(
msg
.
Nonce
(),
n
)
if
msg
.
CheckNonce
()
{
if
n
:=
self
.
state
.
GetNonce
(
sender
.
Address
());
n
!=
msg
.
Nonce
()
{
return
NonceError
(
msg
.
Nonce
(),
n
)
}
}
// Pre-pay gas
...
...
This diff is collapsed.
Click to expand it.
core/types/transaction.go
View file @
00787fe7
...
...
@@ -113,6 +113,7 @@ func (tx *Transaction) Gas() *big.Int { return new(big.Int).Set(tx.data.Gas
func
(
tx
*
Transaction
)
GasPrice
()
*
big
.
Int
{
return
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
Price
)
}
func
(
tx
*
Transaction
)
Value
()
*
big
.
Int
{
return
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
Amount
)
}
func
(
tx
*
Transaction
)
Nonce
()
uint64
{
return
tx
.
data
.
AccountNonce
}
func
(
tx
*
Transaction
)
CheckNonce
()
bool
{
return
true
}
func
(
tx
*
Transaction
)
To
()
*
common
.
Address
{
if
tx
.
data
.
Recipient
==
nil
{
...
...
This diff is collapsed.
Click to expand it.
eth/api.go
View file @
00787fe7
...
...
@@ -424,7 +424,6 @@ func (api *PrivateDebugAPI) traceBlock(block *types.Block, config *vm.Config) (b
// callmsg is the message type used for call transations.
type
callmsg
struct
{
addr
common
.
Address
nonce
uint64
to
*
common
.
Address
gas
,
gasPrice
*
big
.
Int
value
*
big
.
Int
...
...
@@ -434,7 +433,8 @@ type callmsg struct {
// accessor boilerplate to implement core.Message
func
(
m
callmsg
)
From
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
FromFrontier
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
m
.
nonce
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
0
}
func
(
m
callmsg
)
CheckNonce
()
bool
{
return
false
}
func
(
m
callmsg
)
To
()
*
common
.
Address
{
return
m
.
to
}
func
(
m
callmsg
)
GasPrice
()
*
big
.
Int
{
return
m
.
gasPrice
}
func
(
m
callmsg
)
Gas
()
*
big
.
Int
{
return
m
.
gas
}
...
...
This diff is collapsed.
Click to expand it.
internal/ethapi/api.go
View file @
00787fe7
...
...
@@ -534,7 +534,6 @@ func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.A
// callmsg is the message type used for call transations.
type
callmsg
struct
{
addr
common
.
Address
nonce
uint64
to
*
common
.
Address
gas
,
gasPrice
*
big
.
Int
value
*
big
.
Int
...
...
@@ -544,7 +543,8 @@ type callmsg struct {
// accessor boilerplate to implement core.Message
func
(
m
callmsg
)
From
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
FromFrontier
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
m
.
nonce
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
0
}
func
(
m
callmsg
)
CheckNonce
()
bool
{
return
false
}
func
(
m
callmsg
)
To
()
*
common
.
Address
{
return
m
.
to
}
func
(
m
callmsg
)
GasPrice
()
*
big
.
Int
{
return
m
.
gasPrice
}
func
(
m
callmsg
)
Gas
()
*
big
.
Int
{
return
m
.
gas
}
...
...
This diff is collapsed.
Click to expand it.
tests/util.go
View file @
00787fe7
...
...
@@ -312,4 +312,5 @@ func (self Message) GasPrice() *big.Int { return self.price }
func
(
self
Message
)
Gas
()
*
big
.
Int
{
return
self
.
gas
}
func
(
self
Message
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
Message
)
Nonce
()
uint64
{
return
self
.
nonce
}
func
(
self
Message
)
CheckNonce
()
bool
{
return
true
}
func
(
self
Message
)
Data
()
[]
byte
{
return
self
.
data
}
This diff is collapsed.
Click to expand it.
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