- some fiddling on tx_pool

This commit is contained in:
ArchetypicalDude 2018-03-06 11:22:10 +01:00
parent acdd9939ea
commit 47d060e1e8
2 changed files with 15 additions and 5 deletions

View file

@ -920,9 +920,10 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
size = triedb.Size()
limit = common.StorageSize(bc.cacheConfig.TrieNodeLimit) * 1024 * 1024
)
if size > limit || bc.gcproc > bc.cacheConfig.TrieTimeLimit {
if size > 8*limit {
// If we're exceeding limits but haven't reached a large enough memory gap,
// warn the user that the system is becoming unstable.
/*
if chosen < lastWrite+triesInMemory {
switch {
case size >= 2*limit:
@ -931,6 +932,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
log.Info("State in memory for too long, committing", "time", bc.gcproc, "allowance", bc.cacheConfig.TrieTimeLimit, "optimum", float64(chosen-lastWrite)/triesInMemory)
}
}
*/
// If optimum or critical limits reached, write to disk
if chosen >= lastWrite+triesInMemory || size >= 2*limit || bc.gcproc >= 2*bc.cacheConfig.TrieTimeLimit {
triedb.Commit(header.Root, true)

View file

@ -144,15 +144,15 @@ type TxPoolConfig struct {
// pool.
var DefaultTxPoolConfig = TxPoolConfig{
Journal: "transactions.rlp",
Rejournal: time.Hour,
Rejournal: 24*time.Hour,
PriceLimit: 1,
PriceLimit: 50,
PriceBump: 10,
AccountSlots: 16,
GlobalSlots: 4096,
GlobalSlots: 200,
AccountQueue: 64,
GlobalQueue: 1024,
GlobalQueue: 100,
Lifetime: 3 * time.Hour,
}
@ -351,6 +351,14 @@ func (pool *TxPool) lockedReset(oldHead, newHead *types.Header) {
// reset retrieves the current state of the blockchain and ensures the content
// of the transaction pool is valid with regard to the chain state.
func (pool *TxPool) reset(oldHead, newHead *types.Header) {
log.Info("TxPool reset exec")
/*
pool.pending = make(map[common.Address]*txList) // All currently processable transactions
pool.queue = make(map[common.Address]*txList) // Queued but non-processable transactions
pool.beats = make(map[common.Address]time.Time) // Last heartbeat from each known account
pool.all = make(map[common.Hash]*types.Transaction) // All transactions to allow lookups
pool.priced = nil // All transactions sorted by price*/
return
// If we're reorging an old state, reinject all dropped transactions
var reinject types.Transactions