aboutsummaryrefslogtreecommitdiffstats
path: root/core/nonblocking_test.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-11 19:33:25 +0800
committerGitHub <noreply@github.com>2018-10-11 19:33:25 +0800
commit490fa1e9ce2b661e4c8b612bd53f20123346353b (patch)
tree2ef4a4fabb1e21d46ef3e47538dadfeecdf2cf4d /core/nonblocking_test.go
parentf3e9eb613c7e8dec6b8c6b1b0a20ddbec4e91a9c (diff)
downloadtangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar.gz
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar.bz2
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar.lz
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar.xz
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.tar.zst
tangerine-consensus-490fa1e9ce2b661e4c8b612bd53f20123346353b.zip
core: change interface (#193)
* Extract types.FinalizationResult * Change interface: - Application.BlockConfirmed returns whole block. - Application.BlockDelivered returns partial result.
Diffstat (limited to 'core/nonblocking_test.go')
-rw-r--r--core/nonblocking_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/nonblocking_test.go b/core/nonblocking_test.go
index 7599456..8cd42d0 100644
--- a/core/nonblocking_test.go
+++ b/core/nonblocking_test.go
@@ -57,9 +57,9 @@ func (app *slowApp) VerifyBlock(_ *types.Block) bool {
return true
}
-func (app *slowApp) BlockConfirmed(blockHash common.Hash) {
+func (app *slowApp) BlockConfirmed(block types.Block) {
time.Sleep(app.sleep)
- app.blockConfirmed[blockHash] = struct{}{}
+ app.blockConfirmed[block.Hash] = struct{}{}
}
func (app *slowApp) StronglyAcked(blockHash common.Hash) {
@@ -74,9 +74,10 @@ func (app *slowApp) TotalOrderingDelivered(blockHashes common.Hashes, early bool
}
}
-func (app *slowApp) BlockDelivered(block types.Block) {
+func (app *slowApp) BlockDelivered(
+ blockHash common.Hash, _ types.FinalizationResult) {
time.Sleep(app.sleep)
- app.blockDelivered[block.Hash] = struct{}{}
+ app.blockDelivered[blockHash] = struct{}{}
}
type NonBlockingTestSuite struct {
@@ -96,12 +97,12 @@ func (s *NonBlockingTestSuite) TestNonBlocking() {
// Start doing some 'heavy' job.
for _, hash := range hashes {
- nbModule.BlockConfirmed(hash)
- nbModule.StronglyAcked(hash)
- nbModule.BlockDelivered(types.Block{
+ nbModule.BlockConfirmed(types.Block{
Hash: hash,
Witness: types.Witness{Timestamp: time.Now().UTC()},
})
+ nbModule.StronglyAcked(hash)
+ nbModule.BlockDelivered(hash, types.FinalizationResult{})
}
nbModule.TotalOrderingDelivered(hashes, true)