diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-08-10 14:27:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <aitjcize@gmail.com> | 2018-08-10 14:27:42 +0800 |
commit | 3cde438f074ffcead89e28b0a83964d1f1a87062 (patch) | |
tree | 5ec9608581e0f2fc27846aadeb85870bb5c3b2e2 /core | |
parent | b88d8ddb0eaf48fac1fdf10dcd7db4dc896e6538 (diff) | |
download | dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar.gz dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar.bz2 dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar.lz dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar.xz dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.tar.zst dexon-consensus-3cde438f074ffcead89e28b0a83964d1f1a87062.zip |
Fix the bug preventing us from testing large group when using TCP-Local (#42)
* Fix the issue that processing genesis block twice.
- Restore the mechanism to avoid sending block to proposer.
* Fix the 'keep-alive' not working
Quote from comments of net/http/request
For client requests, setting this field prevents re-use of
TCP connections between requests to the same hosts, as if
Transport.DisableKeepAlives were set.
* Remove useless field
* Fix the test bug: I should provide '3' when test K=3
* Fixup: the parent hash of genesis block should be zero
Diffstat (limited to 'core')
-rw-r--r-- | core/reliable-broadcast.go | 7 | ||||
-rw-r--r-- | core/total-ordering_test.go | 2 |
2 files changed, 1 insertions, 8 deletions
diff --git a/core/reliable-broadcast.go b/core/reliable-broadcast.go index e7ae9e7..418ace6 100644 --- a/core/reliable-broadcast.go +++ b/core/reliable-broadcast.go @@ -36,10 +36,6 @@ type reliableBroadcast struct { // receivedBlocks stores blocks which is received but its acks are not all // in lattice. receivedBlocks map[common.Hash]*types.Block - - // ackedBlocks stores blocks in status types.BlockStatusAcked, which are - // strongly acked but not yet being output to total ordering module. - ackedBlocks map[common.Hash]*types.Block } type ackingValidatorStatus struct { @@ -76,7 +72,6 @@ func newReliableBroadcast() *reliableBroadcast { lattice: make(map[types.ValidatorID]*ackingValidatorStatus), blocks: make(map[common.Hash]*types.Block), receivedBlocks: make(map[common.Hash]*types.Block), - ackedBlocks: make(map[common.Hash]*types.Block), } } @@ -208,7 +203,6 @@ func (rb *reliableBroadcast) processBlock(block *types.Block) (err error) { } for _, b := range blocksToAcked { - rb.ackedBlocks[b.Hash] = b b.Status = types.BlockStatusAcked } @@ -284,7 +278,6 @@ func (rb *reliableBroadcast) extractBlocks() []*types.Block { } updated = true b.Status = types.BlockStatusOrdering - delete(rb.ackedBlocks, b.Hash) ret = append(ret, b) rb.lattice[vid].nextOutput++ } diff --git a/core/total-ordering_test.go b/core/total-ordering_test.go index 78b4d96..49b28fa 100644 --- a/core/total-ordering_test.go +++ b/core/total-ordering_test.go @@ -955,7 +955,7 @@ func (s *TotalOrderingTestSuite) TestRandomlyGeneratedBlocks() { s.baseTestRandomlyGeneratedBlocks(constructor, revealer, repeat) // Test for K=3, constructor = func() *totalOrdering { - return newTotalOrdering(2, phi, uint64(validatorCount)) + return newTotalOrdering(3, phi, uint64(validatorCount)) } s.baseTestRandomlyGeneratedBlocks(constructor, revealer, repeat) } |