diff options
author | obscuren <geffobscura@gmail.com> | 2014-11-18 23:58:22 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-11-18 23:58:22 +0800 |
commit | a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b (patch) | |
tree | aee891c8f02591e16377a6bf047c13f12d6d5123 /chain/receipt.go | |
parent | 62cd9946ee16758a4e368cd0b5a0ba9fa4d94705 (diff) | |
download | dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.gz dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.bz2 dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.lz dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.xz dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.zst dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.zip |
Begin of moving objects to types package
* Block(s)
* Transaction(s)
Diffstat (limited to 'chain/receipt.go')
-rw-r--r-- | chain/receipt.go | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/chain/receipt.go b/chain/receipt.go deleted file mode 100644 index fa53f1cdb..000000000 --- a/chain/receipt.go +++ /dev/null @@ -1,60 +0,0 @@ -package chain - -import ( - "bytes" - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" -) - -type Receipt struct { - PostState []byte - CumulativeGasUsed *big.Int - Bloom []byte - logs state.Logs -} - -func NewRecieptFromValue(val *ethutil.Value) *Receipt { - r := &Receipt{} - r.RlpValueDecode(val) - - return r -} - -func (self *Receipt) RlpValueDecode(decoder *ethutil.Value) { - self.PostState = decoder.Get(0).Bytes() - self.CumulativeGasUsed = decoder.Get(1).BigInt() - self.Bloom = decoder.Get(2).Bytes() - - it := decoder.Get(3).NewIterator() - for it.Next() { - self.logs = append(self.logs, state.NewLogFromValue(it.Value())) - } -} - -func (self *Receipt) RlpData() interface{} { - return []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.logs.RlpData()} -} - -func (self *Receipt) RlpEncode() []byte { - return ethutil.Encode(self.RlpData()) -} - -func (self *Receipt) Cmp(other *Receipt) bool { - if bytes.Compare(self.PostState, other.PostState) != 0 { - return false - } - - return true -} - -func (self *Receipt) String() string { - return fmt.Sprintf("receipt{med=%x cgas=%v bloom=%x logs=%v}", self.PostState, self.CumulativeGasUsed, self.Bloom, self.logs) -} - -type Receipts []*Receipt - -func (self Receipts) Len() int { return len(self) } -func (self Receipts) GetRlp(i int) []byte { return ethutil.Rlp(self[i]) } |