Skip to content

Commit

Permalink
use isConfirmed instead of num_confirmations to make filter work with…
Browse files Browse the repository at this point in the history
… CLN
  • Loading branch information
myxmaster committed Nov 22, 2023
1 parent 9fe7183 commit 9b7e623
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
23 changes: 19 additions & 4 deletions utils/ActivityFilterUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,28 @@ describe('ActivityFilterUtils', () => {
).toString(),
num_confirmations: 0
}),
new Transaction({
amount: 3,
time_stamp: (
new Date(2000, 1, 2, 3, 4, 4).getTime() / 1000
).toString(),
status: 'confirmed'
}),
new Transaction({
amount: 4,
time_stamp: (
new Date(2000, 1, 2, 3, 4, 4).getTime() / 1000
).toString(),
status: 'unconfirmed'
}),
new Invoice({
value: '3',
value: '5',
creation_date: (
new Date(2000, 1, 1, 3, 4, 5).getTime() / 1000
).toString()
}),
new Payment({
value: '4',
value: '6',
creation_date: (
new Date(2000, 1, 1, 3, 4, 5).getTime() / 1000
).toString()
Expand All @@ -159,8 +173,9 @@ describe('ActivityFilterUtils', () => {

expect(filteredActivities.map((a) => a.getAmount)).toEqual([
'1',
3,
'4'
'3',
5,
'6'
]);
});

Expand Down
3 changes: 1 addition & 2 deletions utils/ActivityFilterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ class ActivityFilterUtils {
if (filter.unconfirmed == false) {
filteredActivity = filteredActivity.filter(
(activity) =>
!(activity instanceof Transaction) ||
activity.num_confirmations > 0
!(activity instanceof Transaction) || activity.isConfirmed
);
}

Expand Down

0 comments on commit 9b7e623

Please sign in to comment.