Skip to content

Commit

Permalink
Merge pull request #77 from renproject/fix/stuck-txs
Browse files Browse the repository at this point in the history
Update transaction if Darknodes return a "done" status
  • Loading branch information
jazg committed Jul 28, 2020
2 parents ea16111 + b6fb5aa commit e9a893c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions confirmer/confirmer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"math/rand"
"net/url"
"strings"
"time"

"github.com/renproject/darknode/abi"
Expand Down Expand Up @@ -132,11 +133,12 @@ func (confirmer *Confirmer) confirm(ctx context.Context, tx abi.Tx) {
case <-ctx.Done():
return
case response := <-req.Responder:
if response.Error != nil {
if response.Error == nil {
confirmer.logger.Infof("✅ successfully submit tx = %v to darknodes", tx.Hash.String())
} else if response.Error != nil && !strings.Contains(response.Error.Message, "current status = done") {
confirmer.logger.Errorf("[confirmer] getting error back when submitting tx = %v: [%v] %v", tx.Hash.String(), response.Error.Code, response.Error.Message)
return
}
confirmer.logger.Infof("✅ successfully submit tx = %v to darknodes", tx.Hash.String())

if err := confirmer.database.UpdateStatus(tx.Hash, db.TxStatusConfirmed); err != nil {
confirmer.logger.Errorf("[confirmer] cannot confirm tx in the database: %v", err)
Expand Down

0 comments on commit e9a893c

Please sign in to comment.