예제 #1
0
func (self *Object) StorageValue(addr *common.Value) *common.Value {
	return self.storage(addr.Bytes())
}
예제 #2
0
파일: trie.go 프로젝트: ruflin/go-ethereum
// casting functions and cache storing
func (self *Trie) mknode(value *common.Value) Node {
	l := value.Len()
	switch l {
	case 0:
		return nil
	case 2:
		// A value node may consists of 2 bytes.
		if value.Get(0).Len() != 0 {
			key := CompactDecode(string(value.Get(0).Bytes()))
			if key[len(key)-1] == 16 {
				return NewShortNode(self, key, NewValueNode(self, value.Get(1).Bytes()))
			} else {
				return NewShortNode(self, key, self.mknode(value.Get(1)))
			}
		}
	case 17:
		if len(value.Bytes()) != 17 {
			fnode := NewFullNode(self)
			for i := 0; i < 16; i++ {
				fnode.set(byte(i), self.mknode(value.Get(i)))
			}
			return fnode
		}
	case 32:
		return NewHash(value.Bytes(), self)
	}

	return NewValueNode(self, value.Bytes())
}
예제 #3
0
func (self *StateObject) SetState(k common.Hash, value *common.Value) {
	self.storage[k.Str()] = value.Copy()
	self.dirty = true
}