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

Fix outgoing payments order in payments overview #1232

Merged
merged 2 commits into from
Dec 4, 2019

Conversation

dpad85
Copy link
Member

@dpad85 dpad85 commented Dec 4, 2019

Payments overview aggregates outgoing payments by parent_id using a group by. If there are several attempts, there is no guarantee that the output aggregated payment will hold the most recent/pertinent status.

See SQLite doc on bare columns in aggregate queries: https://www.sqlite.org/lang_select.html#bareagg

By using the max function we can force the aggregate output to be the most recent attempt.

@codecov-io
Copy link

Codecov Report

Merging #1232 into master will increase coverage by 0.12%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1232      +/-   ##
==========================================
+ Coverage   76.55%   76.68%   +0.12%     
==========================================
  Files         140      140              
  Lines        9700     9700              
  Branches      397      397              
==========================================
+ Hits         7426     7438      +12     
+ Misses       2274     2262      -12
Impacted Files Coverage Δ
...a/fr/acinq/eclair/db/sqlite/SqlitePaymentsDb.scala 98.5% <ø> (ø) ⬆️
...cinq/eclair/blockchain/bitcoind/zmq/ZMQActor.scala 89.74% <0%> (-5.13%) ⬇️
...-core/src/main/scala/fr/acinq/eclair/io/Peer.scala 75.22% <0%> (-0.3%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 83.77% <0%> (+0.36%) ⬆️
...src/main/scala/fr/acinq/eclair/router/Router.scala 92.71% <0%> (+0.71%) ⬆️
...nq/eclair/blockchain/electrum/ElectrumClient.scala 73.28% <0%> (+1.44%) ⬆️
...clair/blockchain/electrum/ElectrumClientPool.scala 74.19% <0%> (+3.22%) ⬆️

t-bast
t-bast previously approved these changes Dec 4, 2019
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart hack, this is deep SQLite stuff :)

@dpad85 dpad85 merged commit f5a6266 into master Dec 4, 2019
@dpad85 dpad85 deleted the payments-overview-order branch December 4, 2019 16:30
pm47 pushed a commit that referenced this pull request Dec 12, 2019
Using the `max()` aggregating function on outgoing payments' 
timestamps, we can ensure that the non-aggregated columns 
for the outgoing payments contain the most recent/pertinent data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants