diff options
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 2 | ||||
-rw-r--r-- | eth/downloader/downloader_test.go | 8 | ||||
-rw-r--r-- | eth/gasprice.go | 9 | ||||
-rw-r--r-- | eth/protocol_test.go | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/eth/backend.go b/eth/backend.go index 8195110de..e62252b6c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -339,7 +339,7 @@ func New(config *Config) (*Ethereum, error) { eth.pow = ethash.New() genesis := core.GenesisBlock(uint64(config.GenesisNonce), stateDb) - eth.chainManager, err = core.NewChainManager(genesis, blockDb, stateDb, eth.pow, eth.EventMux()) + eth.chainManager, err = core.NewChainManager(genesis, blockDb, stateDb, extraDb, eth.pow, eth.EventMux()) if err != nil { return nil, err } diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index c5fb00289..23549a9ba 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -83,7 +83,13 @@ func newTester() *downloadTester { // sync starts synchronizing with a remote peer, blocking until it completes. func (dl *downloadTester) sync(id string) error { err := dl.downloader.synchronise(id, dl.peerHashes[id][0]) - for atomic.LoadInt32(&dl.downloader.processing) == 1 { + for { + // If the queue is empty and processing stopped, break + hashes, blocks := dl.downloader.queue.Size() + if hashes+blocks == 0 && atomic.LoadInt32(&dl.downloader.processing) == 0 { + break + } + // Otherwise sleep a bit and retry time.Sleep(time.Millisecond) } return err diff --git a/eth/gasprice.go b/eth/gasprice.go index ddf1c8c09..09ef8cded 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -131,13 +131,10 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { // returns the lowers possible price with which a tx was or could have been included func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { gasUsed := new(big.Int) - recepits, err := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) - if err != nil { - return self.eth.GpoMinGasPrice - } - if len(recepits) > 0 { - gasUsed = recepits[len(recepits)-1].CumulativeGasUsed + receipts := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) + if len(receipts) > 0 { + gasUsed = receipts[len(receipts)-1].CumulativeGasUsed } if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 4c1579d4e..2cc3d06ab 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -165,7 +165,7 @@ func newProtocolManagerForTesting(txAdded chan<- []*types.Transaction) *Protocol var ( em = new(event.TypeMux) db, _ = ethdb.NewMemDatabase() - chain, _ = core.NewChainManager(core.GenesisBlock(0, db), db, db, core.FakePow{}, em) + chain, _ = core.NewChainManager(core.GenesisBlock(0, db), db, db, db, core.FakePow{}, em) txpool = &fakeTxPool{added: txAdded} pm = NewProtocolManager(0, em, txpool, core.FakePow{}, chain) ) |