diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-05-06 20:06:20 +0800 |
---|---|---|
committer | Mission Liao <mission.liao@dexon.org> | 2019-05-07 15:09:40 +0800 |
commit | 4ad87afd4fce82bd25f16f1875231e6c6c91d581 (patch) | |
tree | 12ba18c1689d72e8aaec3a678e895a8bff1e27b8 | |
parent | d57aae1be65389442ce5e7d5a3edc5d5f79d920d (diff) | |
download | dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar.gz dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar.bz2 dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar.lz dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar.xz dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.tar.zst dexon-4ad87afd4fce82bd25f16f1875231e6c6c91d581.zip |
Fix lint error: gofmt -s
-rw-r--r-- | dex/consensus/core/agreement.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/blockchain_test.go | 8 | ||||
-rw-r--r-- | dex/consensus/core/consensus.go | 32 | ||||
-rw-r--r-- | dex/consensus/core/crypto/dkg/dkg_test.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/db/level-db_test.go | 8 | ||||
-rw-r--r-- | dex/consensus/core/dkg-tsig-protocol.go | 4 | ||||
-rw-r--r-- | dex/consensus/core/types/position_test.go | 18 | ||||
-rw-r--r-- | dex/consensus/core/utils/round-event.go | 2 |
8 files changed, 38 insertions, 38 deletions
diff --git a/dex/consensus/core/agreement.go b/dex/consensus/core/agreement.go index dd7928ac0..17a527ce2 100644 --- a/dex/consensus/core/agreement.go +++ b/dex/consensus/core/agreement.go @@ -147,7 +147,7 @@ func newAgreement( ID: ID, leader: leader, }, - aID: &atomic.Value{}, + aID: &atomic.Value{}, pendingAgreementResult: make(map[types.Position]*types.AgreementResult), candidateBlock: make(map[common.Hash]*types.Block), fastForward: make(chan uint64, 1), diff --git a/dex/consensus/core/blockchain_test.go b/dex/consensus/core/blockchain_test.go index 3132b2185..797a21ba8 100644 --- a/dex/consensus/core/blockchain_test.go +++ b/dex/consensus/core/blockchain_test.go @@ -154,7 +154,7 @@ func (s *BlockChainTestSuite) newBlockChain(initB *types.Block, &testTSigVerifierGetter{}, s.signer, &common.NullLogger{}) // Provide the genesis round event. s.Require().NoError(bc.notifyRoundEvents([]utils.RoundEventParam{ - utils.RoundEventParam{ + { Round: initRound, Reset: 0, BeginHeight: initHeight, @@ -361,7 +361,7 @@ func (s *BlockChainTestSuite) TestNotifyRoundEvents() { bc := s.newBlockChain(nil, roundLength) newEvent := func(round, reset, height uint64) []utils.RoundEventParam { return []utils.RoundEventParam{ - utils.RoundEventParam{ + { Round: round, Reset: reset, BeginHeight: types.GenesisHeight + height, @@ -400,7 +400,7 @@ func (s *BlockChainTestSuite) TestNextBlockAndTipRound() { var roundLength uint64 = 3 bc := s.newBlockChain(nil, roundLength) s.Require().NoError(bc.notifyRoundEvents([]utils.RoundEventParam{ - utils.RoundEventParam{ + { Round: 1, Reset: 0, BeginHeight: types.GenesisHeight + roundLength, @@ -598,7 +598,7 @@ func (s *BlockChainTestSuite) TestPrepareBlock() { prepare1(true) // Try to propose blocks at height=2, which should trigger round switch. s.Require().NoError(bc.notifyRoundEvents([]utils.RoundEventParam{ - utils.RoundEventParam{ + { Round: 1, Reset: 0, BeginHeight: types.GenesisHeight + roundLength, diff --git a/dex/consensus/core/consensus.go b/dex/consensus/core/consensus.go index ed5989833..7aac54e32 100644 --- a/dex/consensus/core/consensus.go +++ b/dex/consensus/core/consensus.go @@ -694,22 +694,22 @@ func newConsensusForRound( tsigVerifierCache, signer, logger) // Construct Consensus instance. con := &Consensus{ - ID: ID, - app: appModule, - debugApp: debugApp, - gov: gov, - db: db, - network: network, - baConfirmedBlock: make(map[common.Hash]chan<- *types.Block), - dkgReady: sync.NewCond(&sync.Mutex{}), - cfgModule: cfgModule, - bcModule: bcModule, - dMoment: dMoment, - nodeSetCache: nodeSetCache, - tsigVerifierCache: tsigVerifierCache, - signer: signer, - event: common.NewEvent(), - logger: logger, + ID: ID, + app: appModule, + debugApp: debugApp, + gov: gov, + db: db, + network: network, + baConfirmedBlock: make(map[common.Hash]chan<- *types.Block), + dkgReady: sync.NewCond(&sync.Mutex{}), + cfgModule: cfgModule, + bcModule: bcModule, + dMoment: dMoment, + nodeSetCache: nodeSetCache, + tsigVerifierCache: tsigVerifierCache, + signer: signer, + event: common.NewEvent(), + logger: logger, resetDeliveryGuardTicker: make(chan struct{}), msgChan: make(chan types.Msg, 1024), priorityMsgChan: make(chan interface{}, 1024), diff --git a/dex/consensus/core/crypto/dkg/dkg_test.go b/dex/consensus/core/crypto/dkg/dkg_test.go index 43120e222..59015564e 100644 --- a/dex/consensus/core/crypto/dkg/dkg_test.go +++ b/dex/consensus/core/crypto/dkg/dkg_test.go @@ -331,7 +331,7 @@ func (s *DKGTestSuite) TestPrivateKeySharesRLPEncodeDecode() { privShares, _ := NewPrivateKeyShares(10) privShares.shares = append(privShares.shares, PrivateKey{}) privShares.shareIndex = map[ID]int{ - ID{}: 0, + {}: 0, } b, err := rlp.EncodeToBytes(privShares) diff --git a/dex/consensus/core/db/level-db_test.go b/dex/consensus/core/db/level-db_test.go index d68b290ab..8e3951074 100644 --- a/dex/consensus/core/db/level-db_test.go +++ b/dex/consensus/core/db/level-db_test.go @@ -228,10 +228,10 @@ func (s *LevelDBTestSuite) TestDKGProtocolInfoRLPEncodeDecode() { }, AntiComplaintReceived: NodeIDToNodeIDs{ types.NodeID{Hash: common.Hash{0x01}}: map[types.NodeID]struct{}{ - types.NodeID{Hash: common.Hash{0x02}}: {}, + {Hash: common.Hash{0x02}}: {}, }, types.NodeID{Hash: common.Hash{0x03}}: map[types.NodeID]struct{}{ - types.NodeID{Hash: common.Hash{0x04}}: {}, + {Hash: common.Hash{0x04}}: {}, }, }, PrvSharesReceived: NodeID{ @@ -252,10 +252,10 @@ func (s *LevelDBTestSuite) TestDKGProtocolInfoRLPEncodeDecode() { func (s *LevelDBTestSuite) TestNodeIDToNodeIDsRLPEncodeDecode() { m := NodeIDToNodeIDs{ types.NodeID{Hash: common.Hash{0x01}}: map[types.NodeID]struct{}{ - types.NodeID{Hash: common.Hash{0x02}}: {}, + {Hash: common.Hash{0x02}}: {}, }, types.NodeID{Hash: common.Hash{0x03}}: map[types.NodeID]struct{}{ - types.NodeID{Hash: common.Hash{0x04}}: {}, + {Hash: common.Hash{0x04}}: {}, }, } diff --git a/dex/consensus/core/dkg-tsig-protocol.go b/dex/consensus/core/dkg-tsig-protocol.go index ad69a2974..d52106683 100644 --- a/dex/consensus/core/dkg-tsig-protocol.go +++ b/dex/consensus/core/dkg-tsig-protocol.go @@ -160,8 +160,8 @@ func (d *dkgProtocol) toDKGProtocolInfo() db.DKGProtocolInfo { PrvSharesReceived: d.prvSharesReceived, NodeComplained: d.nodeComplained, AntiComplaintReceived: d.antiComplaintReceived, - Step: uint64(d.step), - Reset: d.reset, + Step: uint64(d.step), + Reset: d.reset, } if d.masterPrivateShare != nil { diff --git a/dex/consensus/core/types/position_test.go b/dex/consensus/core/types/position_test.go index d2f416543..b9b74714a 100644 --- a/dex/consensus/core/types/position_test.go +++ b/dex/consensus/core/types/position_test.go @@ -76,15 +76,15 @@ func (s *PositionTestSuite) TestOlder() { func (s *PositionTestSuite) TestSearchInAsendingOrder() { positions := []Position{ - Position{Round: 0, Height: 1}, - Position{Round: 0, Height: 2}, - Position{Round: 0, Height: 3}, - Position{Round: 2, Height: 0}, - Position{Round: 2, Height: 1}, - Position{Round: 2, Height: 2}, - Position{Round: 4, Height: 0}, - Position{Round: 4, Height: 1}, - Position{Round: 4, Height: 2}, + {Round: 0, Height: 1}, + {Round: 0, Height: 2}, + {Round: 0, Height: 3}, + {Round: 2, Height: 0}, + {Round: 2, Height: 1}, + {Round: 2, Height: 2}, + {Round: 4, Height: 0}, + {Round: 4, Height: 1}, + {Round: 4, Height: 2}, } search := func(pos Position) int { return sort.Search(len(positions), func(i int) bool { diff --git a/dex/consensus/core/utils/round-event.go b/dex/consensus/core/utils/round-event.go index ac40981f6..456253db6 100644 --- a/dex/consensus/core/utils/round-event.go +++ b/dex/consensus/core/utils/round-event.go @@ -222,7 +222,7 @@ func (e *RoundEvent) Register(h roundEventFn) { func (e *RoundEvent) TriggerInitEvent() { e.lock.Lock() defer e.lock.Unlock() - events := []RoundEventParam{RoundEventParam{ + events := []RoundEventParam{{ Round: e.lastTriggeredRound, Reset: e.lastTriggeredResetCount, BeginHeight: e.config.LastPeriodBeginHeight(), |