aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-13 18:45:11 +0800
committerobscuren <geffobscura@gmail.com>2014-06-13 18:45:11 +0800
commitd078e9b8c92fb3bd5789a8e39c169b19864e0a04 (patch)
tree34ce9defddbd84364e681362eef072fa5e5dab97 /ethchain/transaction.go
parentb855e5f7df194c84651d7cc7ee32d307a2fa0a2e (diff)
downloadgo-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar.gz
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar.bz2
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar.lz
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar.xz
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.tar.zst
go-tangerine-d078e9b8c92fb3bd5789a8e39c169b19864e0a04.zip
Refactoring state transitioning
Diffstat (limited to 'ethchain/transaction.go')
-rw-r--r--ethchain/transaction.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go
index 32dbd8388..7aaab2fd1 100644
--- a/ethchain/transaction.go
+++ b/ethchain/transaction.go
@@ -46,15 +46,18 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction {
return tx
}
+func (self *Transaction) GasValue() *big.Int {
+ return new(big.Int).Mul(self.Gas, self.GasPrice)
+}
+
+func (self *Transaction) TotalValue() *big.Int {
+ v := self.GasValue()
+ return v.Add(v, self.Value)
+}
+
func (tx *Transaction) Hash() []byte {
data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data}
- /*
- if tx.contractCreation {
- data = append(data, tx.Init)
- }
- */
-
return ethutil.Sha3Bin(ethutil.NewValue(data).Encode())
}
@@ -185,6 +188,7 @@ type Receipt struct {
PostState []byte
CumulativeGasUsed *big.Int
}
+type Receipts []*Receipt
func NewRecieptFromValue(val *ethutil.Value) *Receipt {
r := &Receipt{}