From 0b477712a1d8abb478b5bb00ec103e0bf100c8da Mon Sep 17 00:00:00 2001 From: gary rong Date: Wed, 19 Sep 2018 17:06:55 +0800 Subject: consensus/clique: hide no transaction error (#17614) --- consensus/clique/clique.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'consensus') diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 2b69141c1..eae09f91d 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -134,11 +134,6 @@ var ( // errRecentlySigned is returned if a header is signed by an authorized entity // that already signed a header recently, thus is temporarily not allowed to. errRecentlySigned = errors.New("recently signed") - - // errWaitTransactions is returned if an empty block is attempted to be sealed - // on an instant chain (0 second period). It's important to refuse these as the - // block reward is zero, so an empty block just bloats the chain... fast. - errWaitTransactions = errors.New("waiting for transactions") ) // SignerFn is a signer callback function to request a hash to be signed by a @@ -615,7 +610,8 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, results c } // For 0-period chains, refuse to seal empty blocks (no reward but would spin sealing) if c.config.Period == 0 && len(block.Transactions()) == 0 { - return errWaitTransactions + log.Info("Sealing paused, waiting for transactions") + return nil } // Don't hold the signer fields for the entire sealing procedure c.lock.RLock() -- cgit v1.2.3 From d6254f827bf493c1471a806b7b8a0e9b86c8c420 Mon Sep 17 00:00:00 2001 From: gary rong Date: Thu, 20 Sep 2018 20:09:30 +0800 Subject: all: protect self-mined block during reorg (#17656) --- consensus/clique/snapshot_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'consensus') diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 71fe7ce8b..41dae1426 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -448,7 +448,7 @@ func TestClique(t *testing.T) { batches[len(batches)-1] = append(batches[len(batches)-1], block) } // Pass all the headers through clique and ensure tallying succeeds - chain, err := core.NewBlockChain(db, nil, &config, engine, vm.Config{}) + chain, err := core.NewBlockChain(db, nil, &config, engine, vm.Config{}, nil) if err != nil { t.Errorf("test %d: failed to create test chain: %v", i, err) continue -- cgit v1.2.3