aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-23 17:51:04 +0800
committerobscuren <geffobscura@gmail.com>2014-04-23 17:51:04 +0800
commit3a9a252f6e44abb0f45f57a46c0fa91e2f73c545 (patch)
tree677575939c8f22c30a9601c205450a0d5b98c3ab /ethchain/transaction.go
parent61cd1594b52514244efcb47bd93722aaec0fe456 (diff)
downloaddexon-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.gz
dexon-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.zst
dexon-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.zip
Fixed minor issue with gas and added state object init
Diffstat (limited to 'ethchain/transaction.go')
-rw-r--r--ethchain/transaction.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go
index 1e43a2bae..421f26c98 100644
--- a/ethchain/transaction.go
+++ b/ethchain/transaction.go
@@ -23,12 +23,12 @@ type Transaction struct {
contractCreation bool
}
-func NewContractCreationTx(value, gasprice *big.Int, script []byte, init []byte) *Transaction {
- return &Transaction{Value: value, GasPrice: gasprice, Data: script, Init: init, contractCreation: true}
+func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte, init []byte) *Transaction {
+ return &Transaction{Value: value, Gas: gas, GasPrice: gasPrice, Data: script, Init: init, contractCreation: true}
}
-func NewTransactionMessage(to []byte, value, gasprice, gas *big.Int, data []byte) *Transaction {
- return &Transaction{Recipient: to, Value: value, GasPrice: gasprice, Gas: gas, Data: data}
+func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction {
+ return &Transaction{Recipient: to, Value: value, GasPrice: gasPrice, Gas: gas, Data: data}
}
func NewTransactionFromBytes(data []byte) *Transaction {
@@ -46,9 +46,10 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction {
}
func (tx *Transaction) Hash() []byte {
- data := []interface{}{tx.Nonce, tx.Value, tx.GasPrice, tx.Gas, tx.Recipient, string(tx.Data)}
+ data := []interface{}{tx.Nonce, tx.Value, tx.GasPrice, tx.Gas, tx.Recipient, tx.Data}
+
if tx.contractCreation {
- data = append(data, string(tx.Init))
+ data = append(data, tx.Init)
}
return ethutil.Sha3Bin(ethutil.NewValue(data).Encode())
@@ -112,7 +113,6 @@ func (tx *Transaction) RlpData() interface{} {
if tx.contractCreation {
data = append(data, tx.Init)
}
- //d := ethutil.NewSliceValue(tx.Data).Slice()
return append(data, tx.v, tx.r, tx.s)
}