@@ -21,6 +21,7 @@ import (
21
21
"fmt"
22
22
"os"
23
23
"reflect"
24
+ "strconv"
24
25
"strings"
25
26
"sync"
26
27
"testing"
@@ -1763,7 +1764,7 @@ func TestCheckpointDiffersFromWeakCert(t *testing.T) {
1763
1764
1764
1765
badChkpt := & Checkpoint {
1765
1766
SequenceNumber : 10 ,
1766
- Id : base64 . StdEncoding . EncodeToString ([] byte ( "WRONG" )) ,
1767
+ Id : "WRONG" ,
1767
1768
ReplicaId : 3 ,
1768
1769
}
1769
1770
instance .chkpts [10 ] = badChkpt .Id // This is done via the exec path, shortcut it here
@@ -1772,7 +1773,7 @@ func TestCheckpointDiffersFromWeakCert(t *testing.T) {
1772
1773
for i := uint64 (0 ); i < 2 ; i ++ {
1773
1774
events .SendEvent (instance , & Checkpoint {
1774
1775
SequenceNumber : 10 ,
1775
- Id : base64 . StdEncoding . EncodeToString ([] byte ( "CORRECT" )) ,
1776
+ Id : "CORRECT" ,
1776
1777
ReplicaId : i ,
1777
1778
})
1778
1779
}
@@ -1781,3 +1782,23 @@ func TestCheckpointDiffersFromWeakCert(t *testing.T) {
1781
1782
t .Fatalf ("State target should not have been updated" )
1782
1783
}
1783
1784
}
1785
+
1786
+ // This test is designed to ensure the peer panics if it observes > f+1 different checkpoint values for the same seqNo
1787
+ // This indicates a network that will be unable to move its watermarks and thus progress
1788
+ func TestNoCheckpointQuorum (t * testing.T ) {
1789
+ defer func () {
1790
+ if r := recover (); r == nil {
1791
+ t .Errorf ("More than f+1 different checkpoint values found, should have panicked." )
1792
+ }
1793
+ }()
1794
+
1795
+ instance := newPbftCore (3 , loadConfig (), & omniProto {}, & inertTimerFactory {})
1796
+
1797
+ for i := uint64 (0 ); i < 3 ; i ++ {
1798
+ events .SendEvent (instance , & Checkpoint {
1799
+ SequenceNumber : 10 ,
1800
+ Id : strconv .FormatUint (i , 10 ),
1801
+ ReplicaId : i ,
1802
+ })
1803
+ }
1804
+ }
0 commit comments