Skip to content

Commit

Permalink
Reverse XRPL scanning order (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitryhil authored Mar 6, 2024
1 parent 39b6f2f commit 9ba07a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions integration-tests/xrpl/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ func validateTxsHashesInChannel(
case <-scanCtx.Done():
return scanCtx.Err()
case tx := <-txsCh:
// validate that we have all sent hashed and no duplicated
// validate that we have all sent hashes
hash := strings.ToUpper(tx.GetHash().String())
if _, found := expectedHashes[hash]; !found {
return errors.Errorf("not found expected tx hash:%s", hash)
continue
}

delete(expectedHashes, hash)
Expand Down
2 changes: 1 addition & 1 deletion relayer/xrpl/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (c *RPCClient) AccountTx(
MinLedger: minLedger,
MaxLedger: maxLedger,
Binary: false,
Forward: false,
Forward: true,
Limit: c.cfg.PageLimit,
Marker: marker,
}
Expand Down
4 changes: 1 addition & 3 deletions relayer/xrpl/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (s *AccountScanner) scanTransactions(
lastLedger = prevProcessedLedger
prevProcessedLedger = int64(tx.LedgerSequence)
}
indexRegistryFunc(float64(prevProcessedLedger))
if tx == nil {
continue
}
Expand All @@ -209,9 +210,6 @@ func (s *AccountScanner) scanTransactions(
}
}
}
if prevProcessedLedger != 0 {
indexRegistryFunc(float64(prevProcessedLedger))
}
if len(accountTxResult.Marker) == 0 {
lastLedger = prevProcessedLedger
break
Expand Down

0 comments on commit 9ba07a0

Please sign in to comment.