diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-05-17 00:10:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-17 00:10:58 +0800 |
commit | f5d89cdb72c1e82e9deb54754bef8dd20bf12591 (patch) | |
tree | b6e2ee16b90cd494eaefec59fb4aaaac71cc6a96 /light | |
parent | 60386b3545659d99c7488e456c780606db101936 (diff) | |
parent | 9eba3a9fff2f47f5e094c36a7c905380b0ac8b1f (diff) | |
download | go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar.gz go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar.bz2 go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar.lz go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar.xz go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.tar.zst go-tangerine-f5d89cdb72c1e82e9deb54754bef8dd20bf12591.zip |
Merge pull request #19244 from karalabe/freezer-2
cmd, core, eth, les, node: chain freezer on top of db rework
Diffstat (limited to 'light')
-rw-r--r-- | light/lightchain.go | 6 | ||||
-rw-r--r-- | light/nodeset.go | 6 | ||||
-rw-r--r-- | light/trie.go | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/light/lightchain.go b/light/lightchain.go index 86836dfb5..f0beec47b 100644 --- a/light/lightchain.go +++ b/light/lightchain.go @@ -165,12 +165,12 @@ func (lc *LightChain) loadLastState() error { // SetHead rewinds the local chain to a new head. Everything above the new // head will be deleted and the new one set. -func (lc *LightChain) SetHead(head uint64) { +func (lc *LightChain) SetHead(head uint64) error { lc.chainmu.Lock() defer lc.chainmu.Unlock() - lc.hc.SetHead(head, nil) - lc.loadLastState() + lc.hc.SetHead(head, nil, nil) + return lc.loadLastState() } // GasLimit returns the gas limit of the current HEAD block. diff --git a/light/nodeset.go b/light/nodeset.go index a8bf4f6c6..366259678 100644 --- a/light/nodeset.go +++ b/light/nodeset.go @@ -115,7 +115,7 @@ func (db *NodeSet) NodeList() NodeList { } // Store writes the contents of the set to the given database -func (db *NodeSet) Store(target ethdb.Writer) { +func (db *NodeSet) Store(target ethdb.KeyValueWriter) { db.lock.RLock() defer db.lock.RUnlock() @@ -124,11 +124,11 @@ func (db *NodeSet) Store(target ethdb.Writer) { } } -// NodeList stores an ordered list of trie nodes. It implements ethdb.Writer. +// NodeList stores an ordered list of trie nodes. It implements ethdb.KeyValueWriter. type NodeList []rlp.RawValue // Store writes the contents of the list to the given database -func (n NodeList) Store(db ethdb.Writer) { +func (n NodeList) Store(db ethdb.KeyValueWriter) { for _, node := range n { db.Put(crypto.Keccak256(node), node) } diff --git a/light/trie.go b/light/trie.go index 27abb1dc2..e512bf6f9 100644 --- a/light/trie.go +++ b/light/trie.go @@ -141,7 +141,7 @@ func (t *odrTrie) GetKey(sha []byte) []byte { return nil } -func (t *odrTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.Writer) error { +func (t *odrTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error { return errors.New("not implemented, needs client/server interface split") } |