aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-04 16:38:18 +0800
committerobscuren <geffobscura@gmail.com>2014-08-04 16:38:18 +0800
commit3debeb7236d2c8474fa9049cc91dc26bf1040b3f (patch)
tree928b5ff8486ea485a3efae8cc69adaf54af9c87e /ethchain/block.go
parent2e7cf835222274a311302c33498cf83bb2593b7a (diff)
downloaddexon-3debeb7236d2c8474fa9049cc91dc26bf1040b3f.tar.gz
dexon-3debeb7236d2c8474fa9049cc91dc26bf1040b3f.tar.zst
dexon-3debeb7236d2c8474fa9049cc91dc26bf1040b3f.zip
ethtrie.NewTrie => ethtrie.New
Diffstat (limited to 'ethchain/block.go')
-rw-r--r--ethchain/block.go24
1 files changed, 4 insertions, 20 deletions
diff --git a/ethchain/block.go b/ethchain/block.go
index ac56f58c3..e4486f8e4 100644
--- a/ethchain/block.go
+++ b/ethchain/block.go
@@ -100,7 +100,7 @@ func CreateBlock(root interface{},
}
block.SetUncles([]*Block{})
- block.state = ethstate.NewState(ethtrie.NewTrie(ethutil.Config.Db, root))
+ block.state = ethstate.NewState(ethtrie.New(ethutil.Config.Db, root))
return block
}
@@ -220,26 +220,10 @@ func (self *Block) SetReceipts(receipts []*Receipt, txs []*Transaction) {
func (block *Block) setTransactions(txs []*Transaction) {
block.transactions = txs
-
- /*
- trie := ethtrie.NewTrie(ethutil.Config.Db, "")
- for i, tx := range txs {
- trie.Update(strconv.Itoa(i), string(tx.RlpEncode()))
- }
-
- switch trie.Root.(type) {
- case string:
- block.TxSha = []byte(trie.Root.(string))
- case []byte:
- block.TxSha = trie.Root.([]byte)
- default:
- panic(fmt.Sprintf("invalid root type %T", trie.Root))
- }
- */
}
func CreateTxSha(receipts Receipts) (sha []byte) {
- trie := ethtrie.NewTrie(ethutil.Config.Db, "")
+ trie := ethtrie.New(ethutil.Config.Db, "")
for i, receipt := range receipts {
trie.Update(string(ethutil.NewValue(i).Encode()), string(ethutil.NewValue(receipt.RlpData()).Encode()))
}
@@ -281,7 +265,7 @@ func (block *Block) RlpValueDecode(decoder *ethutil.Value) {
block.PrevHash = header.Get(0).Bytes()
block.UncleSha = header.Get(1).Bytes()
block.Coinbase = header.Get(2).Bytes()
- block.state = ethstate.NewState(ethtrie.NewTrie(ethutil.Config.Db, header.Get(3).Val))
+ block.state = ethstate.NewState(ethtrie.New(ethutil.Config.Db, header.Get(3).Val))
block.TxSha = header.Get(4).Bytes()
block.Difficulty = header.Get(5).BigInt()
block.Number = header.Get(6).BigInt()
@@ -323,7 +307,7 @@ func NewUncleBlockFromValue(header *ethutil.Value) *Block {
block.PrevHash = header.Get(0).Bytes()
block.UncleSha = header.Get(1).Bytes()
block.Coinbase = header.Get(2).Bytes()
- block.state = ethstate.NewState(ethtrie.NewTrie(ethutil.Config.Db, header.Get(3).Val))
+ block.state = ethstate.NewState(ethtrie.New(ethutil.Config.Db, header.Get(3).Val))
block.TxSha = header.Get(4).Bytes()
block.Difficulty = header.Get(5).BigInt()
block.Number = header.Get(6).BigInt()