diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-17 06:10:26 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-17 06:10:26 +0800 |
commit | 843db4978e876674ca111706880a58c84202880d (patch) | |
tree | 6d565f14ae8ed2524c73e478e301891c4d86436e /core/types/receipt.go | |
parent | 4e181c5764b78193705f91d3220710bb63b8962f (diff) | |
download | go-tangerine-843db4978e876674ca111706880a58c84202880d.tar go-tangerine-843db4978e876674ca111706880a58c84202880d.tar.gz go-tangerine-843db4978e876674ca111706880a58c84202880d.tar.bz2 go-tangerine-843db4978e876674ca111706880a58c84202880d.tar.lz go-tangerine-843db4978e876674ca111706880a58c84202880d.tar.xz go-tangerine-843db4978e876674ca111706880a58c84202880d.tar.zst go-tangerine-843db4978e876674ca111706880a58c84202880d.zip |
updated blockpool
Diffstat (limited to 'core/types/receipt.go')
-rw-r--r-- | core/types/receipt.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/core/types/receipt.go b/core/types/receipt.go index be14d0e0e..d0cb41e25 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -3,9 +3,11 @@ package types import ( "bytes" "fmt" + "io" "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/state" ) @@ -20,34 +22,26 @@ func NewReceipt(root []byte, cumalativeGasUsed *big.Int) *Receipt { return &Receipt{PostState: common.CopyBytes(root), CumulativeGasUsed: new(big.Int).Set(cumalativeGasUsed)} } -func NewRecieptFromValue(val *common.Value) *Receipt { - r := &Receipt{} - r.RlpValueDecode(val) - - return r -} - func (self *Receipt) SetLogs(logs state.Logs) { self.logs = logs } -func (self *Receipt) RlpValueDecode(decoder *common.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) EncodeRLP(w io.Writer) error { + return rlp.Encode(w, []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.logs}) } +/* func (self *Receipt) RlpData() interface{} { return []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.logs.RlpData()} } +*/ func (self *Receipt) RlpEncode() []byte { - return common.Encode(self.RlpData()) + bytes, err := rlp.EncodeToBytes(self) + if err != nil { + fmt.Println("TMP -- RECEIPT ENCODE ERROR", err) + } + return bytes } func (self *Receipt) Cmp(other *Receipt) bool { @@ -64,6 +58,7 @@ func (self *Receipt) String() string { type Receipts []*Receipt +/* func (self Receipts) RlpData() interface{} { data := make([]interface{}, len(self)) for i, receipt := range self { @@ -72,9 +67,14 @@ func (self Receipts) RlpData() interface{} { return data } +*/ func (self Receipts) RlpEncode() []byte { - return common.Encode(self.RlpData()) + bytes, err := rlp.EncodeToBytes(self) + if err != nil { + fmt.Println("TMP -- RECEIPTS ENCODE ERROR", err) + } + return bytes } func (self Receipts) Len() int { return len(self) } |