Skip to content

Commit

Permalink
Merge branch 'main' into unikernel-combine-shares
Browse files Browse the repository at this point in the history
  • Loading branch information
nkcr committed May 4, 2022
2 parents bed5786 + 9beae4a commit 890b337
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions proxy/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func (h *election) Elections(w http.ResponseWriter, r *http.Request) {
}

// waitForTxnID blocks until `ID` is included or `events` is closed.
func (h *election) waitForTxnID(events <-chan ordering.Event, ID []byte) bool {
func (h *election) waitForTxnID(events <-chan ordering.Event, ID []byte) error {
for event := range events {
for _, res := range event.Transactions {
if !bytes.Equal(res.GetTransaction().GetID(), ID) {
Expand All @@ -463,12 +463,14 @@ func (h *election) waitForTxnID(events <-chan ordering.Event, ID []byte) bool {

ok, msg := res.GetStatus()
if !ok {
h.logger.Info().Msgf("transaction %x denied : %s", ID, msg)
return xerrors.Errorf("transaction %x denied : %s", ID, msg)
}
return ok

return nil
}
}
return false

return xerrors.New("transaction not found")
}

func (h *election) getElectionsMetadata() (types.ElectionsMetadata, error) {
Expand Down Expand Up @@ -552,9 +554,9 @@ func (h *election) submitAndWaitForTxn(ctx context.Context, cmd evoting.Command,
return nil, xerrors.Errorf("failed to add transaction to the pool: %v", err)
}

ok := h.waitForTxnID(events, tx.GetID())
if !ok {
return nil, xerrors.Errorf("transaction not processed within timeout")
err = h.waitForTxnID(events, tx.GetID())
if err != nil {
return nil, xerrors.Errorf("failed to wait for transaction: %v", err)
}

return tx.GetID(), nil
Expand Down
2 changes: 1 addition & 1 deletion proxy/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"go.dedis.ch/kyber/v3/suites"
)

const inclusionTimeout = 2 * time.Second
const inclusionTimeout = 10 * time.Second

var suite = suites.MustFind("ed25519")

Expand Down

0 comments on commit 890b337

Please sign in to comment.