diff options
-rw-r--r-- | ethchain/block.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ethchain/block.go b/ethchain/block.go index bdb243286..24ff5a32f 100644 --- a/ethchain/block.go +++ b/ethchain/block.go @@ -223,7 +223,15 @@ func (block *Block) SetTransactions(txs []*Transaction) { trie.Update(strconv.Itoa(i), string(tx.RlpEncode())) } - block.TxSha = []byte(trie.Root.(string)) + 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 (block *Block) Value() *ethutil.Value { |