functional and tested setTrieFlushIntervalClone plugin
This commit is contained in:
parent
bff86afa0c
commit
0186a12412
@ -1366,6 +1366,11 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
|||||||
chosen := current - TriesInMemory
|
chosen := current - TriesInMemory
|
||||||
flushInterval := time.Duration(atomic.LoadInt64(&bc.flushInterval))
|
flushInterval := time.Duration(atomic.LoadInt64(&bc.flushInterval))
|
||||||
// If we exceeded time allowance, flush an entire trie to disk
|
// If we exceeded time allowance, flush an entire trie to disk
|
||||||
|
|
||||||
|
// begin PluGeth code injection
|
||||||
|
flushInterval = pluginSetTrieFlushIntervalClone(flushInterval)
|
||||||
|
// end PluGeth code injection
|
||||||
|
|
||||||
if bc.gcproc > flushInterval {
|
if bc.gcproc > flushInterval {
|
||||||
// If the header is missing (canonical chain behind), we're reorging a low
|
// If the header is missing (canonical chain behind), we're reorging a low
|
||||||
// diff sidechain. Suspend committing until this operation is completed.
|
// diff sidechain. Suspend committing until this operation is completed.
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
@ -296,3 +297,24 @@ func pluginGetBlockTracer(hash common.Hash, statedb *state.StateDB) (*metaTracer
|
|||||||
}
|
}
|
||||||
return PluginGetBlockTracer(plugins.DefaultPluginLoader, hash, statedb)
|
return PluginGetBlockTracer(plugins.DefaultPluginLoader, hash, statedb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PluginSetTrieFlushIntervalClone(pl *plugins.PluginLoader, flushInterval time.Duration) time.Duration {
|
||||||
|
fnList := pl.Lookup("SetTrieFlushIntervalClone", func(item interface{}) bool{
|
||||||
|
_, ok := item.(func(time.Duration) time.Duration)
|
||||||
|
return ok
|
||||||
|
})
|
||||||
|
for _, fni := range fnList {
|
||||||
|
log.Error("len fn list", "len", len(fnList))
|
||||||
|
if fn, ok := fni.(func(time.Duration) time.Duration); ok {
|
||||||
|
return fn(flushInterval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flushInterval
|
||||||
|
}
|
||||||
|
|
||||||
|
func pluginSetTrieFlushIntervalClone(flushInterval time.Duration) time.Duration {
|
||||||
|
if plugins.DefaultPluginLoader == nil {
|
||||||
|
log.Warn("Attempting setTreiFlushIntervalClone, but default PluginLoader has not been initialized")
|
||||||
|
}
|
||||||
|
return PluginSetTrieFlushIntervalClone(plugins.DefaultPluginLoader, flushInterval)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user