Altered injection comments for consistencey

This commit is contained in:
philip-morlier 2022-12-06 16:37:18 -08:00
parent 1805f477ae
commit e3080c170c
2 changed files with 9 additions and 8 deletions

View File

@ -1393,7 +1393,8 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types
} else { } else {
pluginNewSideBlock(block, block.Hash(), logs) pluginNewSideBlock(block, block.Hash(), logs)
bc.chainSideFeed.Send(ChainSideEvent{Block: block}) bc.chainSideFeed.Send(ChainSideEvent{Block: block})
} // end PluGeth code injection // end PluGeth code injection
}
return status, nil return status, nil
} }
@ -2089,7 +2090,7 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
} }
//begin PluGeth code injection //begin PluGeth code injection
pluginReorg(commonBlock, oldChain, newChain) pluginReorg(commonBlock, oldChain, newChain)
//begin Plugeth code injection //end PluGeth code injection
logFn(msg, "number", commonBlock.Number(), "hash", commonBlock.Hash(), logFn(msg, "number", commonBlock.Number(), "hash", commonBlock.Hash(),
"drop", len(oldChain), "dropfrom", oldChain[0].Hash(), "add", len(newChain), "addfrom", newChain[0].Hash()) "drop", len(oldChain), "dropfrom", oldChain[0].Hash(), "add", len(newChain), "addfrom", newChain[0].Hash())
blockReorgAddMeter.Mark(int64(len(newChain))) blockReorgAddMeter.Mark(int64(len(newChain)))
@ -2214,14 +2215,14 @@ func (bc *BlockChain) SetCanonical(head *types.Block) (common.Hash, error) {
if len(logs) > 0 { if len(logs) > 0 {
bc.logsFeed.Send(logs) bc.logsFeed.Send(logs)
} }
// begin plugeth code injection // begin PluGeth code injection
ptd := bc.GetTd(head.ParentHash(), head.NumberU64()-1) ptd := bc.GetTd(head.ParentHash(), head.NumberU64()-1)
externTd := ptd externTd := ptd
if ptd != nil { if ptd != nil {
externTd = new(big.Int).Add(head.Difficulty(), ptd) externTd = new(big.Int).Add(head.Difficulty(), ptd)
} }
pluginNewHead(head, head.Hash(), logs, externTd) pluginNewHead(head, head.Hash(), logs, externTd)
// end plugeth code injection // end PluGeth code injection
bc.chainHeadFeed.Send(ChainHeadEvent{Block: head}) bc.chainHeadFeed.Send(ChainHeadEvent{Block: head})
context := []interface{}{ context := []interface{}{

View File

@ -917,18 +917,18 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
storageTrieNodes int storageTrieNodes int
nodes = trie.NewMergedNodeSet() nodes = trie.NewMergedNodeSet()
) )
// PluGeth injection // begin PluGeth injection
codeUpdates := make(map[common.Hash][]byte) codeUpdates := make(map[common.Hash][]byte)
// PluGeth injection // end PluGeth injection
codeWriter := s.db.TrieDB().DiskDB().NewBatch() codeWriter := s.db.TrieDB().DiskDB().NewBatch()
for addr := range s.stateObjectsDirty { for addr := range s.stateObjectsDirty {
if obj := s.stateObjects[addr]; !obj.deleted { if obj := s.stateObjects[addr]; !obj.deleted {
// Write any contract code associated with the state object // Write any contract code associated with the state object
if obj.code != nil && obj.dirtyCode { if obj.code != nil && obj.dirtyCode {
rawdb.WriteCode(codeWriter, common.BytesToHash(obj.CodeHash()), obj.code) rawdb.WriteCode(codeWriter, common.BytesToHash(obj.CodeHash()), obj.code)
// PluGeth injection // begin PluGeth injection
codeUpdates[common.BytesToHash(obj.CodeHash())] = obj.code codeUpdates[common.BytesToHash(obj.CodeHash())] = obj.code
// PluGeth injection // end PluGeth injection
obj.dirtyCode = false obj.dirtyCode = false
} }
// Write any storage changes in the state object to its storage trie // Write any storage changes in the state object to its storage trie