From b0cfa3037f82d1e13e08666538ae3915201698c1 Mon Sep 17 00:00:00 2001 From: MestryOmkar Date: Sat, 24 Nov 2018 17:55:15 +0530 Subject: [PATCH] fixed error --- core/blockchain.go | 14 +++++--------- core/genesis.go | 2 +- miner/worker.go | 10 +++++----- swarm/api/http/error.go | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 81be81a666..bf9e6ee1fd 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -141,9 +141,9 @@ type BlockChain struct { validator Validator // block and state validator interface vmConfig vm.Config - badBlocks *lru.Cache // Bad block cache - IPCEndpoint string - Client *ethclient.Client // Global ipc client instance. + badBlocks *lru.Cache // Bad block cache + IPCEndpoint string + Client *ethclient.Client // Global ipc client instance. } // NewBlockChain returns a fully initialised block chain using information @@ -1221,7 +1221,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty } } } - } // Append a single chain head event if we've progressed the chain if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() { @@ -1428,9 +1427,8 @@ func (bc *BlockChain) insertBlock(block *types.Block) ([]interface{}, []*types.L events = append(events, ChainHeadEvent{block}) log.Debug("New ChainHeadEvent from fetcher ", "number", block.NumberU64(), "hash", block.Hash()) } - return events, coalescedLogs, nil -} +} // insertStats tracks and reports on block insertion. type insertStats struct { @@ -1660,11 +1658,9 @@ func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, e log.Error(fmt.Sprintf(` ########## BAD BLOCK ######### Chain config: %v - Number: %v Hash: 0x%x %v - Error: %v ############################## `, bc.chainConfig, block.Number(), block.Hash(), receiptString, err)) @@ -1872,4 +1868,4 @@ func (bc *BlockChain) UpdateM1() error { log.Info("Masternodes are ready for the next epoch") } return nil -} +} \ No newline at end of file diff --git a/core/genesis.go b/core/genesis.go index 8fab2684de..c5445151d3 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -366,7 +366,7 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis { common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing - faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, + faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, }, } } diff --git a/miner/worker.go b/miner/worker.go index d4aa64767a..3fc2d989a2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -612,12 +612,12 @@ func (self *worker) commitNewWork() { delete(self.possibleUncles, hash) } } - // Create the new block to seal with the consensus engine - if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil { - log.Error("Failed to finalize block for sealing", "err", err) - return - } if atomic.LoadInt32(&self.mining) == 1 { + // Create the new block to seal with the consensus engine + if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil { + log.Error("Failed to finalize block for sealing", "err", err) + return + } log.Info("Committing new block", "number", work.Block.Number(), "txs", work.tcount, "special txs", len(specialTxs), "uncles", len(uncles), "elapsed", common.PrettyDuration(time.Since(tstart))) self.unconfirmed.Shift(work.Block.NumberU64() - 1) self.lastParentBlockCommit = parent.Hash().Hex() diff --git a/swarm/api/http/error.go b/swarm/api/http/error.go index 2f77f2784a..9a65412cf9 100644 --- a/swarm/api/http/error.go +++ b/swarm/api/http/error.go @@ -71,7 +71,7 @@ func initErrHandling() { multipleChoicesPage := GetMultipleChoicesErrorPage() //map the codes to the available pages tnames := map[int]string{ - 0: genErrPage, //default + 0: genErrPage, //default http.StatusBadRequest: genErrPage, http.StatusNotFound: notFoundPage, http.StatusMultipleChoices: multipleChoicesPage,