From 9e2f071d26d5c4ed343d2a91e48fec4e7751b99d Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 29 Oct 2014 14:20:42 +0100 Subject: Removed events from the state manager --- ethchain/block.go | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'ethchain/block.go') diff --git a/ethchain/block.go b/ethchain/block.go index e4a1aaf24..b31d68e4d 100644 --- a/ethchain/block.go +++ b/ethchain/block.go @@ -5,7 +5,6 @@ import ( "fmt" "math/big" "sort" - _ "strconv" "time" "github.com/ethereum/go-ethereum/ethcrypto" @@ -240,15 +239,19 @@ func (block *Block) SetUncles(uncles []*Block) { block.UncleSha = ethcrypto.Sha3(ethutil.Encode(block.rlpUncles())) } -func (self *Block) SetReceipts(receipts []*Receipt, txs []*Transaction) { +func (self *Block) SetReceipts(receipts Receipts) { self.receipts = receipts + self.SetReceiptHash(receipts) +} + +func (self *Block) SetTransactions(txs Transactions) { self.setTransactions(txs) + self.SetTransactionHash(txs) } -func (block *Block) setTransactions(txs []*Transaction) { +func (block *Block) setTransactions(txs Transactions) { block.transactions = txs - - block.LogsBloom = CreateBloom(txs) + block.LogsBloom = CreateBloom(block) } func (self *Block) SetTransactionHash(transactions Transactions) { @@ -424,22 +427,7 @@ func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(self.RlpEncode())) } -/* -func DeriveReceiptHash(receipts Receipts) (sha []byte) { - trie := ethtrie.New(ethutil.Config.Db, "") - for i, receipt := range receipts { - trie.Update(string(ethutil.NewValue(i).Encode()), string(ethutil.NewValue(receipt.RlpData()).Encode())) - } - - switch trie.Root.(type) { - case string: - sha = []byte(trie.Root.(string)) - case []byte: - sha = trie.Root.([]byte) - default: - panic(fmt.Sprintf("invalid root type %T", trie.Root)) - } - - return sha +// Implement RlpEncodable +func (self *Block) RlpData() interface{} { + return self.Value().Val } -*/ -- cgit v1.2.3