mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
trie: update markers prior to insert (stacktrie)
This commit is contained in:
parent
c0ae61fa15
commit
80768aae8a
1 changed files with 3 additions and 3 deletions
|
|
@ -101,9 +101,6 @@ func (t *StackTrie) Update(key, value []byte) error {
|
||||||
if bytes.Compare(t.last, k) >= 0 {
|
if bytes.Compare(t.last, k) >= 0 {
|
||||||
return errors.New("non-ascending key order")
|
return errors.New("non-ascending key order")
|
||||||
}
|
}
|
||||||
if err := t.insert(t.root, k, value, nil); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// track the first and last inserted entries.
|
// track the first and last inserted entries.
|
||||||
if t.first == nil {
|
if t.first == nil {
|
||||||
t.first = append([]byte{}, k...)
|
t.first = append([]byte{}, k...)
|
||||||
|
|
@ -113,6 +110,9 @@ func (t *StackTrie) Update(key, value []byte) error {
|
||||||
} else {
|
} else {
|
||||||
t.last = append(t.last[:0], k...) // reuse key slice
|
t.last = append(t.last[:0], k...) // reuse key slice
|
||||||
}
|
}
|
||||||
|
if err := t.insert(t.root, k, value, nil); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue