diff options
author | obscuren <obscuren@obscura.com> | 2014-01-03 07:43:49 +0800 |
---|---|---|
committer | obscuren <obscuren@obscura.com> | 2014-01-03 07:43:49 +0800 |
commit | 7cd41ac45aed7ee22ef02f8abedf83a2914c4807 (patch) | |
tree | 7a4c3daee8a04dc9604098407f019bb5db9ea3d4 /transaction.go | |
parent | 9df4c745119b3ed10a7ad17887e8dd9cac249af7 (diff) | |
download | go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar.gz go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar.bz2 go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar.lz go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar.xz go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.tar.zst go-tangerine-7cd41ac45aed7ee22ef02f8abedf83a2914c4807.zip |
Wip VM. Created contracts
Diffstat (limited to 'transaction.go')
-rw-r--r-- | transaction.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/transaction.go b/transaction.go index 562593c96..dc5204f9b 100644 --- a/transaction.go +++ b/transaction.go @@ -3,8 +3,8 @@ package main import ( "math/big" "fmt" - "encoding/hex" - "crypto/sha256" + _"encoding/hex" + _"crypto/sha256" _ "bytes" ) @@ -63,13 +63,14 @@ func NewTransaction(to string, value uint32, data []string) *Transaction { tx.data[i] = instr } - b:= []byte(tx.MarshalRlp()) - hash := sha256.Sum256(b) - tx.addr = hex.EncodeToString(hash[0:19]) return &tx } +func (tx *Transaction) Hash() []byte { + return Sha256Bin(tx.MarshalRlp()) +} + func (tx *Transaction) MarshalRlp() []byte { // Prepare the transaction for serialization preEnc := []interface{}{ |