Skip to content

Commit

Permalink
Prior history after registration
Browse files Browse the repository at this point in the history
  • Loading branch information
vqhuy committed Dec 3, 2016
1 parent dcd2e3a commit 561f908
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion protocol/consistencychecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion protocol/consistencychecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,18 @@ 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)
}

// register
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()
Expand Down

0 comments on commit 561f908

Please sign in to comment.