forked from cerc-io/plugeth
Left comments on all PluGeth code injections
This commit is contained in:
committed by
Austin Roberts
parent
4211c5c401
commit
fd0aaa1d6b
@@ -151,6 +151,7 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
|
||||
sdb.snapStorage = make(map[common.Hash]map[common.Hash][]byte)
|
||||
}
|
||||
}
|
||||
// Start PluGeth section
|
||||
if sdb.snap == nil {
|
||||
log.Debug("Snapshots not availble. Using plugin snapshot.")
|
||||
sdb.snap = &pluginSnapshot{root}
|
||||
@@ -158,6 +159,7 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
|
||||
sdb.snapAccounts = make(map[common.Hash][]byte)
|
||||
sdb.snapStorage = make(map[common.Hash]map[common.Hash][]byte)
|
||||
}
|
||||
// End PluGeth section
|
||||
return sdb, nil
|
||||
}
|
||||
|
||||
@@ -891,6 +893,7 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
|
||||
func (s *StateDB) Prepare(thash common.Hash, ti int) {
|
||||
s.thash = thash
|
||||
s.txIndex = ti
|
||||
s.accessList = newAccessList()
|
||||
}
|
||||
|
||||
func (s *StateDB) clearJournalAndRefund() {
|
||||
@@ -976,8 +979,10 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
|
||||
}
|
||||
// Only update if there's a state transition (skip empty Clique blocks)
|
||||
if parent := s.snap.Root(); parent != root {
|
||||
//begin PluGeth code injection
|
||||
pluginStateUpdate(root, parent, s.snapDestructs, s.snapAccounts, s.snapStorage, codeUpdates)
|
||||
if _, ok := s.snap.(*pluginSnapshot); !ok && s.snaps != nil {
|
||||
if _, ok := s.snap.(*pluginSnapshot); !ok && s.snaps != nil { // This if statement (but not its content) was added by PluGeth
|
||||
//end PluGeth injection
|
||||
if err := s.snaps.Update(root, parent, s.snapDestructs, s.snapAccounts, s.snapStorage); err != nil {
|
||||
log.Warn("Failed to update snapshot tree", "from", parent, "to", root, "err", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user