aboutsummaryrefslogtreecommitdiffstats
path: root/core/nonblocking_test.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-01 18:19:52 +0800
committerGitHub <noreply@github.com>2018-10-01 18:19:52 +0800
commit9c33b9dc8aa59d414a6697f1e2d036e5581860ee (patch)
tree74a4a77b5c28fa9a550fe1ba40b5b2efac0e7630 /core/nonblocking_test.go
parent9b78db7a4744176070bf968d50dbebb191b28b69 (diff)
downloadtangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.gz
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.bz2
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.lz
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.xz
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.zst
tangerine-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.zip
core: update data model to reflect new model (#157)
Update data model: 1) Remove witness ack. 2) Add round to block. 3) Update governance interface.
Diffstat (limited to 'core/nonblocking_test.go')
-rw-r--r--core/nonblocking_test.go21
1 files changed, 3 insertions, 18 deletions
diff --git a/core/nonblocking_test.go b/core/nonblocking_test.go
index d4ffb26..8c3cda9 100644
--- a/core/nonblocking_test.go
+++ b/core/nonblocking_test.go
@@ -33,8 +33,6 @@ type slowApp struct {
stronglyAcked map[common.Hash]struct{}
totalOrderingDelivered map[common.Hash]struct{}
blockDelivered map[common.Hash]struct{}
- witnessAck map[common.Hash]struct{}
- witnessResultChan chan types.WitnessResult
}
func newSlowApp(sleep time.Duration) *slowApp {
@@ -44,16 +42,14 @@ func newSlowApp(sleep time.Duration) *slowApp {
stronglyAcked: make(map[common.Hash]struct{}),
totalOrderingDelivered: make(map[common.Hash]struct{}),
blockDelivered: make(map[common.Hash]struct{}),
- witnessAck: make(map[common.Hash]struct{}),
- witnessResultChan: make(chan types.WitnessResult),
}
}
-func (app *slowApp) PreparePayload(_ types.Position) []byte {
- return []byte{}
+func (app *slowApp) PrepareBlock(_ types.Position) ([]byte, []byte) {
+ return []byte{}, []byte{}
}
-func (app *slowApp) VerifyPayload(_ []byte) bool {
+func (app *slowApp) VerifyBlock(_ *types.Block) bool {
return true
}
@@ -79,15 +75,6 @@ func (app *slowApp) BlockDelivered(block types.Block) {
app.blockDelivered[block.Hash] = struct{}{}
}
-func (app *slowApp) BlockProcessedChan() <-chan types.WitnessResult {
- return app.witnessResultChan
-}
-
-func (app *slowApp) WitnessAckDelivered(witnessAck *types.WitnessAck) {
- time.Sleep(app.sleep)
- app.witnessAck[witnessAck.Hash] = struct{}{}
-}
-
type NonBlockingTestSuite struct {
suite.Suite
}
@@ -111,7 +98,6 @@ func (s *NonBlockingTestSuite) TestNonBlocking() {
Hash: hash,
Witness: types.Witness{Timestamp: time.Now().UTC()},
})
- nbModule.WitnessAckDelivered(&types.WitnessAck{Hash: hash})
}
nbModule.TotalOrderingDelivered(hashes, true)
@@ -124,7 +110,6 @@ func (s *NonBlockingTestSuite) TestNonBlocking() {
s.Contains(app.stronglyAcked, hash)
s.Contains(app.totalOrderingDelivered, hash)
s.Contains(app.blockDelivered, hash)
- s.Contains(app.witnessAck, hash)
}
}