Skip to content

Commit

Permalink
do not fail if transaction is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dan13ram committed Oct 5, 2023
1 parent b071e5f commit 4f24bd8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
9 changes: 7 additions & 2 deletions eth/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,13 @@ func (x *MintSignerRunner) ValidateMint(mint *models.Mint) (bool, error) {
return false, errors.New("Error fetching transaction: " + err.Error())
}

if tx.Tx == "" || tx.TxResult.Code != 0 {
log.Debug("[MINT SIGNER] Transaction not found or failed")
if tx == nil || tx.Tx == "" {
log.Debug("[MINT SIGNER] Transaction not found")
return false, errors.New("Transaction not found")
}

if tx.TxResult.Code != 0 {
log.Debug("[MINT SIGNER] Transaction failed")
return false, nil
}

Expand Down
9 changes: 9 additions & 0 deletions pokt/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func (x *BurnExecutorRunner) HandleInvalidMint(doc *models.InvalidMint) bool {
log.Error("[BURN EXECUTOR] Error fetching transaction: ", err)
return false
}
if tx == nil || tx.Tx == "" {
log.Error("[BURN EXECUTOR] Invalid mint return tx not found: ", doc.ReturnTxHash)
return false
}

filter = bson.M{
"_id": doc.Id,
Expand Down Expand Up @@ -163,6 +167,11 @@ func (x *BurnExecutorRunner) HandleBurn(doc *models.Burn) bool {
return false
}

if tx == nil || tx.Tx == "" {
log.Error("[BURN EXECUTOR] Burn return tx not found: ", doc.ReturnTxHash)
return false
}

filter = bson.M{
"_id": doc.Id,
"status": models.StatusSubmitted,
Expand Down
8 changes: 6 additions & 2 deletions pokt/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ func (x *BurnSignerRunner) ValidateInvalidMint(doc *models.InvalidMint) (bool, e
return false, errors.New("Error fetching transaction: " + err.Error())
}

if tx.Tx == "" || tx.TxResult.Code != 0 {
log.Debug("[BURN SIGNER] Transaction not found or failed")
if tx == nil || tx.Tx == "" {
return false, errors.New("Transaction not found")
}

if tx.TxResult.Code != 0 {
log.Debug("[BURN SIGNER] Transaction failed")
return false, nil
}

Expand Down

0 comments on commit 4f24bd8

Please sign in to comment.