events: Fix double apply in events.Called as well

This commit is contained in:
Łukasz Magiera 2019-12-04 13:58:22 +01:00
parent 7d80cbfbdf
commit 631a9cd3b6
2 changed files with 10 additions and 0 deletions

View File

@ -183,6 +183,10 @@ func (e *calledEvents) applyWithConfidence(ts *types.TipSet) {
}
for _, event := range events {
if event.called {
continue
}
trigger := e.triggers[event.trigger]
if trigger.disabled {
continue

View File

@ -604,6 +604,12 @@ func TestCalled(t *testing.T) {
require.Equal(t, false, reverted)
applied = false
// dip below confidence
fcs.advance(2, 2, nil) // H=10 (confidence=3, apply)
require.Equal(t, false, applied)
require.Equal(t, false, reverted)
require.Equal(t, uint64(7), appliedTs.Height())
require.Equal(t, "bafkqaaa", appliedTs.Blocks()[0].Messages.String())
require.Equal(t, uint64(10), appliedH)