diff --git a/protocol/consistencychecks.go b/protocol/consistencychecks.go index 16831df..cd97b73 100644 --- a/protocol/consistencychecks.go +++ b/protocol/consistencychecks.go @@ -275,7 +275,7 @@ func (cc *ConsistencyChecks) verifyMonitoring(msg *Response, wasUnameAbsent := ap0.ProofType() == m.ProofOfAbsence switch { - case !ok && str0.Epoch == 0 && wasUnameAbsent: /* prior history verification */ + case str0.Epoch == 0 && wasUnameAbsent: /* prior history verification */ case ok && str0.Epoch == regEp && wasUnameAbsent: /* registration epoch */ case ok && str0.Epoch >= regEp+1 && !wasUnameAbsent: /* after registration */ default: diff --git a/protocol/consistencychecks_test.go b/protocol/consistencychecks_test.go index 3bb7399..570eafe 100644 --- a/protocol/consistencychecks_test.go +++ b/protocol/consistencychecks_test.go @@ -275,7 +275,7 @@ func TestVerifyMonitoring(t *testing.T) { for i := 0; i < N; i++ { d.Update() } - if err := monitorAndVerify(d, cc, alice, nil, cc.SavedSTR.Epoch, d.LatestSTR().Epoch); err != CheckPassed { + if err := monitorAndVerify(d, cc, alice, nil, 0, d.LatestSTR().Epoch); err != CheckPassed { t.Error(err) } @@ -283,6 +283,10 @@ func TestVerifyMonitoring(t *testing.T) { if _, e2 := registerAndVerify(d, cc, alice, key); e2 != CheckPassed { t.Error("Cannot register new binding") } + // or we can verify prior history after registering + if err := monitorAndVerify(d, cc, alice, nil, 0, d.LatestSTR().Epoch); err != CheckPassed { + t.Error(err) + } // monitor binding was inserted d.Update()