Skip to content

Commit

Permalink
Add todo to remove extra filter
Browse files Browse the repository at this point in the history
  • Loading branch information
fatemeh-ra committed Dec 22, 2024
1 parent 9afbe21 commit dd00b84
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/permit-check/lib/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ class NodePermitHealthCheckParam extends AbstractPermitHealthCheckParam {
limit: this.API_REQUEST_LIMIT,
});

boxes
boxes.forEach((box) => {
/**
* TODO: remove extra filter (local:ergo/rosen-bridge/health-check/-/issues/43)
* The getBoxesByAddressUnspent node API has issues: it returns not only
* unspent boxes for the specified address but also unrelated boxes from
* different addresses
* This filter is added to ensure such boxes do not interfere with the
* results
*/
.filter(
(box) =>
box.address == this.permitAddress && box.spentTransactionId == null,
)
.forEach((box) => {
if (
box.address == this.permitAddress &&
box.spentTransactionId == null
) {
const R4 = box.additionalRegisters['R4'];
if (
R4 &&
Expand All @@ -64,7 +64,8 @@ class NodePermitHealthCheckParam extends AbstractPermitHealthCheckParam {
box.assets?.find((token) => token.tokenId === this.RWT)?.amount ??
0n;
}
});
}
});

offset += this.API_REQUEST_LIMIT;
} while (boxes.length > 0);
Expand Down

0 comments on commit dd00b84

Please sign in to comment.