Commit ba0a85a5 authored by George Hotz's avatar George Hotz

builds but segfaults

parent 60a349f4
...@@ -43,7 +43,7 @@ func (db *Database) ContractCodeSize(addrHash common.Hash, codeHash common.Hash) ...@@ -43,7 +43,7 @@ func (db *Database) ContractCodeSize(addrHash common.Hash, codeHash common.Hash)
// OpenStorageTrie opens the storage trie of an account. // OpenStorageTrie opens the storage trie of an account.
func (db *Database) OpenStorageTrie(addrHash, root common.Hash) (Trie, error) { func (db *Database) OpenStorageTrie(addrHash, root common.Hash) (Trie, error) {
return simpleTrie{}, nil return SimpleTrie{}, nil
} }
type LeafCallback func(paths [][]byte, hexpath []byte, leaf []byte, parent common.Hash) error type LeafCallback func(paths [][]byte, hexpath []byte, leaf []byte, parent common.Hash) error
...@@ -73,28 +73,28 @@ type Trie interface { ...@@ -73,28 +73,28 @@ type Trie interface {
Commit(onleaf LeafCallback) (common.Hash, error) Commit(onleaf LeafCallback) (common.Hash, error)
} }
type simpleTrie struct { type SimpleTrie struct {
BlockNumber *big.Int BlockNumber *big.Int
StateRoot common.Hash StateRoot common.Hash
} }
func (trie simpleTrie) Commit(onleaf LeafCallback) (common.Hash, error) { func (trie SimpleTrie) Commit(onleaf LeafCallback) (common.Hash, error) {
return trie.StateRoot, nil return trie.StateRoot, nil
} }
func (trie simpleTrie) Hash() common.Hash { func (trie SimpleTrie) Hash() common.Hash {
return trie.StateRoot return trie.StateRoot
} }
func (trie simpleTrie) TryUpdate(key, value []byte) error { func (trie SimpleTrie) TryUpdate(key, value []byte) error {
return nil return nil
} }
func (trie simpleTrie) TryDelete(key []byte) error { func (trie SimpleTrie) TryDelete(key []byte) error {
return nil return nil
} }
func (trie simpleTrie) TryGet(key []byte) ([]byte, error) { func (trie SimpleTrie) TryGet(key []byte) ([]byte, error) {
address := common.BytesToAddress(key) address := common.BytesToAddress(key)
addrHash := crypto.Keccak256Hash(address[:]) addrHash := crypto.Keccak256Hash(address[:])
unhashMap[addrHash] = address unhashMap[addrHash] = address
......
...@@ -18,6 +18,11 @@ var ( ...@@ -18,6 +18,11 @@ var (
emptyRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421") emptyRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
) )
type revision struct {
id int
journalIndex int
}
type StateDB struct { type StateDB struct {
db Database db Database
prefetcher *triePrefetcher prefetcher *triePrefetcher
...@@ -81,7 +86,7 @@ func NewStateDB(header types.Header) *StateDB { ...@@ -81,7 +86,7 @@ func NewStateDB(header types.Header) *StateDB {
stateObjectsDirty: make(map[common.Address]struct{}), stateObjectsDirty: make(map[common.Address]struct{}),
stateRoot: header.Root, stateRoot: header.Root,
db: Database{BlockNumber: header.Number, StateRoot: header.Root}, db: Database{BlockNumber: header.Number, StateRoot: header.Root},
trie: Trie{BlockNumber: header.Number, StateRoot: header.Root}, trie: SimpleTrie{BlockNumber: header.Number, StateRoot: header.Root},
accessList: newAccessList(), accessList: newAccessList(),
logs: make(map[common.Hash][]*types.Log), logs: make(map[common.Hash][]*types.Log),
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment