Skip to content

multi: persist swap cost and report over rpc - #55

Merged
Roasbeef merged 5 commits into
lightninglabs:masterfrom
joostjager:report-cost
May 21, 2019
Merged

multi: persist swap cost and report over rpc#55
Roasbeef merged 5 commits into
lightninglabs:masterfrom
joostjager:report-cost

Conversation

@joostjager

Copy link
Copy Markdown
Contributor

Previously swap cost only showed up as a log line in the loopd output. This PR extends reporting to the rpc level and modifies loop monitor to display the costs after the swap finishes.

Costs are also stored in the database so that costs of completed swaps can be retrieved.

A current limitation is that in some cases when loopd is restarted while a swap is pending, the off-chain costs will be reported as zero. This can be fixed when the lnd reliable payment PRs are in.

@joostjager
joostjager force-pushed the report-cost branch 3 times, most recently from 0dedcf6 to 39997a9 Compare May 15, 2019 12:13
@joostjager
joostjager requested a review from Roasbeef May 16, 2019 13:24

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! This should address the biggest complaint we've seen so far from clients. I've completed a first pass review, and will have also launched a series of new swaps on testnet to exercise the new RPC and CLI modifcations.

Comment thread loopdb/store.go Outdated
Comment thread loopdb/store.go Outdated
Comment thread loopdb/swapstate.go
Comment thread cmd/loop/main.go
Comment thread loopout.go
Comment thread loopdb/meta.go Outdated
@Roasbeef

Copy link
Copy Markdown
Member
2019-05-17T21:19:52-04:00 LOOP_OUT SUCCESS 0.0025 BTC - tb1qx8tjr3nserllpeyuq8c79yf2eq2ew3rs23c7gdvlzchwtjclhywqnz5aqv (cost: server 123, onchain 138, offchain 0)

We should tack on a unit suffix, in this case being satoshis.

@joostjager

Copy link
Copy Markdown
Contributor Author

We should tack on a unit suffix, in this case being satoshis.

We also don't show a unit when the swap is initiated. Adding the unit here would bring the number of different formats to three:
500000, 500000 SAT and 0.005 BTC

I would leave it in line with the cli for this pr.

This commits lays down the foundation in the database for adding more
persistent state data to swaps.
Previous code in log.go assumed there would by sub system level
enable/disable for loop. This is not yet in place, so converting to same
style as used in the lndclient package.
@joostjager

Copy link
Copy Markdown
Contributor Author

@Roasbeef ptal

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Migration went smoothly 👍

LGTM 🦎

@Roasbeef
Roasbeef merged commit 7fd2f11 into lightninglabs:master May 21, 2019
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.

2 participants