alexbosworth / lightning

Lightning client methods
MIT License
127 stars 33 forks source link

Fix final page paging for 'getFailedPayments' and 'getPayments' methods #55

Closed vindard closed 2 years ago

vindard commented 2 years ago

Description

Adjust the lastPageFirstIndexOffset value and check to be consistent across the 'getPayments' and 'getFailedPayments' methods since internally they both paginate in the exact same way. In both cases if there are payments present in the lnd then the last offset is 1, but if there are no payments then the last offset is 0.

Also noteworthy, when you go back with a token of {"offset":1,"limit":250} you would get 0 payments back for both methods, which confirms that a last offset of 1 works fine.

I also removed a redundant ternary check to make the returns for both methods consistent.