From 57b4580c1a1fba86d875ebd5a0e2a2b29346dd3b Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Thu, 9 Aug 2018 15:57:41 +0700 Subject: [PATCH] add again code directory clique from commit c3fbc2401281338637d11102829ecdf7ae742697 --- consensus/clique/snapshot.go | 8 ++++---- consensus/clique/snapshot_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/consensus/clique/snapshot.go b/consensus/clique/snapshot.go index 0fb01fbc12..9ebdb8df15 100644 --- a/consensus/clique/snapshot.go +++ b/consensus/clique/snapshot.go @@ -45,8 +45,8 @@ type Tally struct { // Snapshot is the state of the authorization voting at a given point in time. type Snapshot struct { - config *params.PosvConfig // Consensus engine parameters to fine tune behavior - sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover + config *params.CliqueConfig // Consensus engine parameters to fine tune behavior + sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover Number uint64 `json:"number"` // Block number where the snapshot was created Hash common.Hash `json:"hash"` // Block hash where the snapshot was created @@ -59,7 +59,7 @@ type Snapshot struct { // newSnapshot creates a new snapshot with the specified startup parameters. This // method does not initialize the set of recent signers, so only ever use if for // the genesis block. -func newSnapshot(config *params.PosvConfig, sigcache *lru.ARCCache, number uint64, hash common.Hash, signers []common.Address) *Snapshot { +func newSnapshot(config *params.CliqueConfig, sigcache *lru.ARCCache, number uint64, hash common.Hash, signers []common.Address) *Snapshot { snap := &Snapshot{ config: config, sigcache: sigcache, @@ -76,7 +76,7 @@ func newSnapshot(config *params.PosvConfig, sigcache *lru.ARCCache, number uint6 } // loadSnapshot loads an existing snapshot from the database. -func loadSnapshot(config *params.PosvConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) { +func loadSnapshot(config *params.CliqueConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) { blob, err := db.Get(append([]byte("clique-"), hash[:]...)) if err != nil { return nil, err diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 33a564ac11..8b51e6e094 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -74,7 +74,7 @@ type testerChainReader struct { db ethdb.Database } -func (r *testerChainReader) Config() *params.ChainConfig { return params.AllPosvProtocolChanges } +func (r *testerChainReader) Config() *params.ChainConfig { return params.AllCliqueProtocolChanges } func (r *testerChainReader) CurrentHeader() *types.Header { panic("not supported") } func (r *testerChainReader) GetHeader(common.Hash, uint64) *types.Header { panic("not supported") } func (r *testerChainReader) GetBlock(common.Hash, uint64) *types.Block { panic("not supported") } @@ -374,7 +374,7 @@ func TestVoting(t *testing.T) { // Pass all the headers through clique and ensure tallying succeeds head := headers[len(headers)-1] - snap, err := New(¶ms.PosvConfig{Epoch: tt.epoch}, db).snapshot(&testerChainReader{db: db}, head.Number.Uint64(), head.Hash(), headers) + snap, err := New(¶ms.CliqueConfig{Epoch: tt.epoch}, db).snapshot(&testerChainReader{db: db}, head.Number.Uint64(), head.Hash(), headers) if err != nil { t.Errorf("test %d: failed to create voting snapshot: %v", i, err) continue