diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-21 07:04:31 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-21 07:04:31 +0800 |
commit | 9cf8ce9ef82bfb37fea92bbea6a8d326af00adc8 (patch) | |
tree | 4816383a97b754199430184e6b245e51ea529bd7 /ethchain/transaction.go | |
parent | f567f89b994bf28f908410223084a6702d05d156 (diff) | |
download | dexon-9cf8ce9ef82bfb37fea92bbea6a8d326af00adc8.tar.gz dexon-9cf8ce9ef82bfb37fea92bbea6a8d326af00adc8.tar.zst dexon-9cf8ce9ef82bfb37fea92bbea6a8d326af00adc8.zip |
New tx methods and added new vm to state manager
Diffstat (limited to 'ethchain/transaction.go')
-rw-r--r-- | ethchain/transaction.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go index 57df9cdc4..3b07c81d4 100644 --- a/ethchain/transaction.go +++ b/ethchain/transaction.go @@ -13,22 +13,31 @@ type Transaction struct { Nonce uint64 Recipient []byte Value *big.Int + Gas *big.Int + Gasprice *big.Int Data []string - Memory []int v byte r, s []byte } func NewTransaction(to []byte, value *big.Int, data []string) *Transaction { - tx := Transaction{Recipient: to, Value: value} - tx.Nonce = 0 - - // Serialize the data - tx.Data = data + tx := Transaction{Recipient: to, Value: value, Nonce: 0, Data: data} return &tx } +func NewContractCreationTx(value, gasprice *big.Int, data []string) *Transaction { + return &Transaction{Value: value, Gasprice: gasprice, Data: data} +} + +func NewContractMessageTx(to []byte, value, gasprice, gas *big.Int, data []string) *Transaction { + return &Transaction{Recipient: to, Value: value, Gasprice: gasprice, Gas: gas, Data: data} +} + +func NewTx(to []byte, value *big.Int, data []string) *Transaction { + return &Transaction{Recipient: to, Value: value, Gasprice: big.NewInt(0), Gas: big.NewInt(0), Nonce: 0, Data: data} +} + // XXX Deprecated func NewTransactionFromData(data []byte) *Transaction { return NewTransactionFromBytes(data) |