aboutsummaryrefslogtreecommitdiffstats
path: root/transaction.go
diff options
context:
space:
mode:
Diffstat (limited to 'transaction.go')
-rw-r--r--transaction.go11
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{}{