Skip to content

Commit 890b337

Browse files
committedMay 4, 2022
Merge branch 'main' into unikernel-combine-shares
2 parents bed5786 + 9beae4a commit 890b337

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed
 

‎proxy/election.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func (h *election) Elections(w http.ResponseWriter, r *http.Request) {
454454
}
455455

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

464464
ok, msg := res.GetStatus()
465465
if !ok {
466-
h.logger.Info().Msgf("transaction %x denied : %s", ID, msg)
466+
return xerrors.Errorf("transaction %x denied : %s", ID, msg)
467467
}
468-
return ok
468+
469+
return nil
469470
}
470471
}
471-
return false
472+
473+
return xerrors.New("transaction not found")
472474
}
473475

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

555-
ok := h.waitForTxnID(events, tx.GetID())
556-
if !ok {
557-
return nil, xerrors.Errorf("transaction not processed within timeout")
557+
err = h.waitForTxnID(events, tx.GetID())
558+
if err != nil {
559+
return nil, xerrors.Errorf("failed to wait for transaction: %v", err)
558560
}
559561

560562
return tx.GetID(), nil

‎proxy/mod.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"go.dedis.ch/kyber/v3/suites"
1717
)
1818

19-
const inclusionTimeout = 2 * time.Second
19+
const inclusionTimeout = 10 * time.Second
2020

2121
var suite = suites.MustFind("ed25519")
2222

0 commit comments

Comments
 (0)
Please sign in to comment.