aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-05 03:41:24 +0800
committerobscuren <geffobscura@gmail.com>2015-04-05 03:41:24 +0800
commiteb1c26746d08e6a725fbd64b10f28105684e54db (patch)
tree1ba3f0f70d06f9cf585e1de052a0731bac57a9ef /core/types
parenteb8f0b85f750b7843bb3909116ea71f85a1988a6 (diff)
downloaddexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar.gz
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar.bz2
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar.lz
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar.xz
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.tar.zst
dexon-eb1c26746d08e6a725fbd64b10f28105684e54db.zip
Changed R S to big int and fixed tests
Diffstat (limited to 'core/types')
-rw-r--r--core/types/block_test.go4
-rw-r--r--core/types/transaction.go20
-rw-r--r--core/types/transaction_test.go4
3 files changed, 22 insertions, 6 deletions
diff --git a/core/types/block_test.go b/core/types/block_test.go
index e4f6c38a5..b52ddffdc 100644
--- a/core/types/block_test.go
+++ b/core/types/block_test.go
@@ -44,8 +44,8 @@ func TestBlockEncoding(t *testing.T) {
GasLimit: big.NewInt(50000),
AccountNonce: 0,
V: 27,
- R: common.FromHex("9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f"),
- S: common.FromHex("8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1"),
+ R: common.String2Big("0x9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f"),
+ S: common.String2Big("0x8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1"),
Recipient: &to,
},
})
diff --git a/core/types/transaction.go b/core/types/transaction.go
index f5aa89a15..6f438ad9d 100644
--- a/core/types/transaction.go
+++ b/core/types/transaction.go
@@ -28,11 +28,27 @@ type Transaction struct {
}
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 {
- 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 {
diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go
index 6a015cb9a..dada424e9 100644
--- a/core/types/transaction_test.go
+++ b/core/types/transaction_test.go
@@ -30,8 +30,8 @@ var (
Amount: big.NewInt(10),
Payload: common.FromHex("5544"),
V: 28,
- R: common.FromHex("98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a"),
- S: common.FromHex("8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"),
+ R: common.String2Big("0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a"),
+ S: common.String2Big("0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"),
}
)