aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-19 17:57:02 +0800
committerobscuren <geffobscura@gmail.com>2015-03-19 17:57:02 +0800
commitd7ab716eea1d1892e3358b1dece6b0e2cd31fce8 (patch)
treec0fe4ca2dc47ff8512065f3601b9f3ab6b21dd43 /trie/trie.go
parente67d32b46744928b07b4d964ae3dede9a1ffdddf (diff)
downloadgo-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar.gz
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar.bz2
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar.lz
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar.xz
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.tar.zst
go-tangerine-d7ab716eea1d1892e3358b1dece6b0e2cd31fce8.zip
Fixed mkdnode & added some tests
Diffstat (limited to 'trie/trie.go')
-rw-r--r--trie/trie.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 1c1112a7f..4f47151a4 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -6,8 +6,8 @@ import (
"fmt"
"sync"
- "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/crypto"
)
func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) {
@@ -305,11 +305,13 @@ func (self *Trie) mknode(value *common.Value) Node {
return NewShortNode(self, CompactDecode(string(value.Get(0).Bytes())), self.mknode(value.Get(1)))
}
case 17:
- fnode := NewFullNode(self)
- for i := 0; i < l; i++ {
- fnode.set(byte(i), self.mknode(value.Get(i)))
+ if len(value.Bytes()) != 17 {
+ fnode := NewFullNode(self)
+ for i := 0; i < l; i++ {
+ fnode.set(byte(i), self.mknode(value.Get(i)))
+ }
+ return fnode
}
- return fnode
case 32:
return &HashNode{value.Bytes(), self}
}