aboutsummaryrefslogtreecommitdiffstats
path: root/core/agreement_test.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-25 10:14:42 +0800
committerJimmy Hu <jimmy.hu@dexon.org>2019-03-27 15:25:10 +0800
commitb8ced165b1fb03394f8758e08148b0e5d06aa07b (patch)
treefa327764a4cf564bb4aa39c1570ffd7f292c7ba1 /core/agreement_test.go
parent6efe199cb38eb4cb9a9a64d98ff5f8c4fb997da7 (diff)
downloaddexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.gz
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.bz2
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.lz
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.xz
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.zst
dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.zip
core: Remove agreement result (#514)
* core: remove agreement result for round with randomness * remove agr test in syncer * fixup * remove randomness field from agreement result * modify test
Diffstat (limited to 'core/agreement_test.go')
-rw-r--r--core/agreement_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/agreement_test.go b/core/agreement_test.go
index dfeb783..175249f 100644
--- a/core/agreement_test.go
+++ b/core/agreement_test.go
@@ -559,6 +559,24 @@ func (s *AgreementTestSuite) TestFindBlockInPendingSet() {
s.Require().NotNil(block)
}
+func (s *AgreementTestSuite) TestConfirmWithBlock() {
+ a, _ := s.newAgreement(4, -1, func(*types.Block) (bool, error) {
+ return true, nil
+ })
+ block := &types.Block{
+ Hash: common.NewRandomHash(),
+ Position: a.agreementID(),
+ Finalization: types.FinalizationResult{
+ Randomness: []byte{0x1, 0x2, 0x3, 0x4},
+ },
+ }
+ a.processFinalizedBlock(block)
+ s.Require().Len(s.confirmChan, 1)
+ confirm := <-s.confirmChan
+ s.Equal(block.Hash, confirm)
+ s.True(a.confirmed())
+}
+
func TestAgreement(t *testing.T) {
suite.Run(t, new(AgreementTestSuite))
}