Skip to content

Commit

Permalink
save (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-dambovaliev authored Mar 16, 2024
1 parent afc9307 commit b117ddb
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions core/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,18 @@ func (t *Tendermint) runPropose(ctx context.Context) {
case <-ctx.Done():
return
case getMessagesFn := <-ch:
// TODO filter and verify messages
// TODO move to prevote if the proposal is valid
_ = getMessagesFn()
prpMsgs := getMessagesFn()
msgs := make([]Message, 0)

messages.ConvertToInterface(prpMsgs, func(m *types.ProposalMessage) {
msgs = append(msgs, m)
})

majority := t.verifier.Quorum(msgs)

if majority {
t.state.step.Set(prevote)
}
}
}
}
Expand Down Expand Up @@ -392,9 +401,18 @@ func (t *Tendermint) runPrevote(ctx context.Context) {
case <-ctx.Done():
return
case getMessagesFn := <-ch:
// TODO filter and verify messages
// TODO move to precommit if the proposal is valid
_ = getMessagesFn()
prvMsgs := getMessagesFn()
msgs := make([]Message, 0)

messages.ConvertToInterface(prvMsgs, func(m *types.PrevoteMessage) {
msgs = append(msgs, m)
})

majority := t.verifier.Quorum(msgs)

if majority {
t.state.step.Set(precommit)
}
}
}
}
Expand Down Expand Up @@ -434,9 +452,18 @@ func (t *Tendermint) runPrecommit(ctx context.Context) []byte {
case <-ctx.Done():
return nil
case getMessagesFn := <-ch:
// TODO filter and verify messages
// TODO move to precommit if the proposal is valid
_ = getMessagesFn()
prcMsgs := getMessagesFn()
msgs := make([]Message, 0)

messages.ConvertToInterface(prcMsgs, func(m *types.PrecommitMessage) {
msgs = append(msgs, m)
})

majority := t.verifier.Quorum(msgs)

if majority {
return nil
}
}
}
}

0 comments on commit b117ddb

Please sign in to comment.