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
eb1c2674
Commit
eb1c2674
authored
10 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed R S to big int and fixed tests
parent
eb8f0b85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
8 deletions
+28
-8
transaction_pool_test.go
core/transaction_pool_test.go
+6
-2
block_test.go
core/types/block_test.go
+2
-2
transaction.go
core/types/transaction.go
+18
-2
transaction_test.go
core/types/transaction_test.go
+2
-2
No files found.
core/transaction_pool_test.go
View file @
eb1c2674
...
@@ -2,14 +2,15 @@ package core
...
@@ -2,14 +2,15 @@ package core
import
(
import
(
"crypto/ecdsa"
"crypto/ecdsa"
"math/big"
"testing"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/core/state"
)
)
// State query interface
// State query interface
...
@@ -88,7 +89,10 @@ func TestRemoveInvalid(t *testing.T) {
...
@@ -88,7 +89,10 @@ func TestRemoveInvalid(t *testing.T) {
func
TestInvalidSender
(
t
*
testing
.
T
)
{
func
TestInvalidSender
(
t
*
testing
.
T
)
{
pool
,
_
:=
setup
()
pool
,
_
:=
setup
()
err
:=
pool
.
ValidateTransaction
(
new
(
types
.
Transaction
))
tx
:=
new
(
types
.
Transaction
)
tx
.
R
=
new
(
big
.
Int
)
tx
.
S
=
new
(
big
.
Int
)
err
:=
pool
.
ValidateTransaction
(
tx
)
if
err
!=
ErrInvalidSender
{
if
err
!=
ErrInvalidSender
{
t
.
Errorf
(
"expected %v, got %v"
,
ErrInvalidSender
,
err
)
t
.
Errorf
(
"expected %v, got %v"
,
ErrInvalidSender
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
core/types/block_test.go
View file @
eb1c2674
...
@@ -44,8 +44,8 @@ func TestBlockEncoding(t *testing.T) {
...
@@ -44,8 +44,8 @@ func TestBlockEncoding(t *testing.T) {
GasLimit
:
big
.
NewInt
(
50000
),
GasLimit
:
big
.
NewInt
(
50000
),
AccountNonce
:
0
,
AccountNonce
:
0
,
V
:
27
,
V
:
27
,
R
:
common
.
FromHex
(
"
9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f"
),
R
:
common
.
String2Big
(
"0x
9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f"
),
S
:
common
.
FromHex
(
"
8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1"
),
S
:
common
.
String2Big
(
"0x
8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1"
),
Recipient
:
&
to
,
Recipient
:
&
to
,
},
},
})
})
...
...
This diff is collapsed.
Click to expand it.
core/types/transaction.go
View file @
eb1c2674
...
@@ -28,11 +28,27 @@ type Transaction struct {
...
@@ -28,11 +28,27 @@ type Transaction struct {
}
}
func
NewContractCreationTx
(
amount
,
gasLimit
,
gasPrice
*
big
.
Int
,
data
[]
byte
)
*
Transaction
{
func
NewContractCreationTx
(
amount
,
gasLimit
,
gasPrice
*
big
.
Int
,
data
[]
byte
)
*
Transaction
{
return
&
Transaction
{
Recipient
:
nil
,
Amount
:
amount
,
GasLimit
:
gasLimit
,
Price
:
gasPrice
,
Payload
:
data
}
return
&
Transaction
{
Recipient
:
nil
,
Amount
:
amount
,
GasLimit
:
gasLimit
,
Price
:
gasPrice
,
Payload
:
data
,
R
:
new
(
big
.
Int
),
S
:
new
(
big
.
Int
),
}
}
}
func
NewTransactionMessage
(
to
common
.
Address
,
amount
,
gasAmount
,
gasPrice
*
big
.
Int
,
data
[]
byte
)
*
Transaction
{
func
NewTransactionMessage
(
to
common
.
Address
,
amount
,
gasAmount
,
gasPrice
*
big
.
Int
,
data
[]
byte
)
*
Transaction
{
return
&
Transaction
{
Recipient
:
&
to
,
Amount
:
amount
,
GasLimit
:
gasAmount
,
Price
:
gasPrice
,
Payload
:
data
}
return
&
Transaction
{
Recipient
:
&
to
,
Amount
:
amount
,
GasLimit
:
gasAmount
,
Price
:
gasPrice
,
Payload
:
data
,
R
:
new
(
big
.
Int
),
S
:
new
(
big
.
Int
),
}
}
}
func
NewTransactionFromBytes
(
data
[]
byte
)
*
Transaction
{
func
NewTransactionFromBytes
(
data
[]
byte
)
*
Transaction
{
...
...
This diff is collapsed.
Click to expand it.
core/types/transaction_test.go
View file @
eb1c2674
...
@@ -30,8 +30,8 @@ var (
...
@@ -30,8 +30,8 @@ var (
Amount
:
big
.
NewInt
(
10
),
Amount
:
big
.
NewInt
(
10
),
Payload
:
common
.
FromHex
(
"5544"
),
Payload
:
common
.
FromHex
(
"5544"
),
V
:
28
,
V
:
28
,
R
:
common
.
FromHex
(
"
98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a"
),
R
:
common
.
String2Big
(
"0x
98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a"
),
S
:
common
.
FromHex
(
"
8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
),
S
:
common
.
String2Big
(
"0x
8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
),
}
}
)
)
...
...
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