From 3a49a4af4fb9bce9d8299463629eefa9469d16ba Mon Sep 17 00:00:00 2001 From: DinhLN Date: Thu, 4 Oct 2018 15:15:32 +0700 Subject: [PATCH] Add penalty feature for prevent signer without sign in epoc make slow down chain. Fixed duplicate nonce value for randomize and sign txs Fixed prevent signers penaltied return in 4 epocs sequent. --- core/blockchain.go | 10 +++++----- eth/backend.go | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index efd6c0758e..8b61d18dcd 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -690,7 +690,7 @@ func (bc *BlockChain) procFutureBlocks() { // Insert one by one as chain insertion needs contiguous ancestry between blocks for i := range blocks { - bc.InsertChain(blocks[i : i+1]) + bc.InsertChain(blocks[i: i+1]) } } } @@ -699,9 +699,9 @@ func (bc *BlockChain) procFutureBlocks() { type WriteStatus byte const ( - NonStatTy WriteStatus = iota - CanonStatTy - SideStatTy + NonStatTy WriteStatus = iota + CanonStatTy + SideStatTy ) // Rollback is designed to remove a chain of links from the database that aren't @@ -1243,7 +1243,7 @@ func (st *insertStats) report(chain []*types.Block, index int, cache common.Stor if index == len(chain)-1 || elapsed >= statsReportLimit { var ( end = chain[index] - txs = countTransactions(chain[st.lastIndex : index+1]) + txs = countTransactions(chain[st.lastIndex: index+1]) ) context := []interface{}{ "blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000, diff --git a/eth/backend.go b/eth/backend.go index 6299a7017f..c67ed1bad6 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -282,7 +282,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } return penSigners, nil } - return []common.Address{}, nil }