From 47d060e1e88742154c12d0b20e6974e9218368fe Mon Sep 17 00:00:00 2001 From: ArchetypicalDude Date: Tue, 6 Mar 2018 11:22:10 +0100 Subject: [PATCH] - some fiddling on tx_pool --- core/blockchain.go | 4 +++- core/tx_pool.go | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 4ae0e4f4ec..eca9f63094 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -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) diff --git a/core/tx_pool.go b/core/tx_pool.go index dc3ddc4232..35f0511b8b 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -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