Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listpays is not sorted #4481

Closed
fiatjaf opened this issue Apr 19, 2021 · 2 comments · Fixed by #4518 or #4567
Closed

listpays is not sorted #4481

fiatjaf opened this issue Apr 19, 2021 · 2 comments · Fixed by #4518 or #4567
Assignees
Milestone

Comments

@fiatjaf
Copy link
Contributor

fiatjaf commented Apr 19, 2021

Issue and Steps to Reproduce

lightning-cli listpays

Returns an unsorted list of payments.

getinfo output

{
   "id": "02c16cca44562b590dd279c942200bdccfd4f990c3a69fad620c10ef2f8228eaff",
   "alias": "@lntxbot",
   "color": "296683",
   "num_peers": 37,
   "num_pending_channels": 2,
   "num_active_channels": 22,
   "num_inactive_channels": 2,
   "address": [
      {
         "type": "ipv4",
         "address": "5.2.67.89",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "v0.9.3-107-ga020602",
   "blockheight": 679798,
   "network": "bitcoin",
   "msatoshi_fees_collected": 32991436,
   "fees_collected_msat": "32991436msat",
   "lightning-dir": "/home/fiatjaf/.lightning1/bitcoin"
}
@cdecker
Copy link
Member

cdecker commented Apr 21, 2021

Very good catch, indeed the listpays command, implemented by the pay plugin maintains a map of payment_hash to payment details entries. Map iteration is unsorted, and so is the listpays output.

What would you expect to be the order returned? Would created_at be a reasonable sorting key?

@cdecker cdecker self-assigned this Apr 21, 2021
@cdecker cdecker added this to the v0.10.1 milestone Apr 21, 2021
@fiatjaf
Copy link
Contributor Author

fiatjaf commented Apr 22, 2021

Yes, created_at. I'm currently using jq to sort myself but once I forgot to do that and was very confused. I imagine other people are also getting confused and I will be again myself.

cdecker added a commit to cdecker/lightning that referenced this issue May 31, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue May 31, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Sep 20, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Sep 27, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Sep 28, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 6, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
cdecker added a commit to cdecker/lightning that referenced this issue Oct 8, 2021
Fixes ElementsProject#4482
Fixes ElementsProject#4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
rustyrussell pushed a commit that referenced this issue Oct 13, 2021
Fixes #4482
Fixes #4481

Changelog-Added: pay: Payment attempts are now grouped by the pay command that initiated them
Changelog-Fixed: pay: `listpays` returns payments orderd by their creation date
Changelog-Fixed: pay: `listpays` no longer groups attempts from multiple attempts to pay an invoice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants