Skip to content

Commit

Permalink
Small changes - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed Sep 13, 2023
1 parent ff01be7 commit 711194d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
16 changes: 1 addition & 15 deletions services/horizon/internal/txsub/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,5 @@ func checkTxAlreadyExists(ctx context.Context, db HorizonDB, hash, sourceAddress
}
defer db.Rollback()

tx, err := txResultByHash(ctx, db, hash)
if err == ErrNoResults {
var sequenceNumbers map[string]uint64
sequenceNumbers, err = db.GetSequenceNumbers(ctx, []string{sourceAddress})
if err != nil {
return tx, errors.Wrapf(err, "cannot fetch sequence number for %v", sourceAddress)
}

_, ok := sequenceNumbers[sourceAddress]
if !ok {
return tx, ErrNoAccount
}
return tx, ErrNoResults
}
return tx, err
return txResultByHash(ctx, db, hash)
}
4 changes: 3 additions & 1 deletion services/horizon/internal/txsub/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ func (sys *System) Submit(
}

// add transaction to open list
sys.Pending.Add(ctx, hash, resultCh)
if err := sys.Pending.Add(ctx, hash, resultCh); err != nil {
sys.finish(ctx, hash, resultCh, Result{Err: err})
}
return
}

Expand Down

0 comments on commit 711194d

Please sign in to comment.