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
0e93b985
Commit
0e93b985
authored
Dec 19, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transaction was generating incorrect hash because of var changes
parent
5da5db5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
state_transition.go
core/state_transition.go
+1
-1
transaction.go
core/types/transaction.go
+10
-9
No files found.
core/state_transition.go
View file @
0e93b985
...
...
@@ -112,7 +112,7 @@ func (self *StateTransition) BuyGas() error {
sender
:=
self
.
From
()
if
sender
.
Balance
()
.
Cmp
(
MessageGasValue
(
self
.
msg
))
<
0
{
return
fmt
.
Errorf
(
"
Insufficient funds to pre-pay gas. Req %v, has %v"
,
MessageGasValue
(
self
.
msg
),
sender
.
Balance
())
return
fmt
.
Errorf
(
"
insufficient ETH for gas (%x). Req %v, has %v"
,
sender
.
Address
()[
:
4
]
,
MessageGasValue
(
self
.
msg
),
sender
.
Balance
())
}
coinbase
:=
self
.
Coinbase
()
...
...
core/types/transaction.go
View file @
0e93b985
...
...
@@ -47,7 +47,7 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction {
}
func
(
tx
*
Transaction
)
Hash
()
[]
byte
{
data
:=
[]
interface
{}{
tx
.
Nonce
,
tx
.
gasPrice
,
tx
.
gas
,
tx
.
recipient
,
tx
.
Value
,
tx
.
D
ata
}
data
:=
[]
interface
{}{
tx
.
nonce
,
tx
.
gasPrice
,
tx
.
gas
,
tx
.
recipient
,
tx
.
value
,
tx
.
d
ata
}
return
crypto
.
Sha3
(
ethutil
.
NewValue
(
data
)
.
Encode
())
}
...
...
@@ -108,8 +108,8 @@ func (tx *Transaction) PublicKey() []byte {
sig
:=
append
(
r
,
s
...
)
sig
=
append
(
sig
,
v
-
27
)
pubkey
:=
crypto
.
Ecrecover
(
append
(
hash
,
sig
...
))
//
pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
//
pubkey := crypto.Ecrecover(append(hash, sig...))
pubkey
,
_
:=
secp256k1
.
RecoverPubkey
(
hash
,
sig
)
return
pubkey
}
...
...
@@ -138,9 +138,7 @@ func (tx *Transaction) Sign(privk []byte) error {
}
func
(
tx
*
Transaction
)
RlpData
()
interface
{}
{
data
:=
[]
interface
{}{
tx
.
Nonce
,
tx
.
GasPrice
,
tx
.
Gas
,
tx
.
recipient
,
tx
.
Value
,
tx
.
Data
}
// TODO Remove prefixing zero's
data
:=
[]
interface
{}{
tx
.
nonce
,
tx
.
gasPrice
,
tx
.
gas
,
tx
.
recipient
,
tx
.
value
,
tx
.
data
}
return
append
(
data
,
tx
.
v
,
new
(
big
.
Int
)
.
SetBytes
(
tx
.
r
)
.
Bytes
(),
new
(
big
.
Int
)
.
SetBytes
(
tx
.
s
)
.
Bytes
())
}
...
...
@@ -184,6 +182,7 @@ func (tx *Transaction) String() string {
V: 0x%x
R: 0x%x
S: 0x%x
Hex: %x
`
,
tx
.
Hash
(),
len
(
tx
.
recipient
)
==
0
,
...
...
@@ -192,11 +191,13 @@ func (tx *Transaction) String() string {
tx
.
nonce
,
tx
.
gasPrice
,
tx
.
gas
,
tx
.
V
alue
,
tx
.
D
ata
,
tx
.
v
alue
,
tx
.
d
ata
,
tx
.
v
,
tx
.
r
,
tx
.
s
)
tx
.
s
,
ethutil
.
Encode
(
tx
),
)
}
// Transaction slice type for basic sorting
...
...
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