2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-08 01:10:29 +00:00
Commit Graph

52 Commits

Author SHA1 Message Date
carla
d1c26a20da
multi: surface server swap initiation grpc error codes
Formatting our error was stifling any grpc error returned by the
server. Instead, we bubble up our grpc error, setting an unknown
code if the server did not specifically return an error code.
2021-07-19 10:28:34 +02:00
carla
f166ce899d
loopout: cancel swap with server when off-chain fails 2021-05-24 08:46:03 +02:00
carla
16111352a8
multi: add cancel swap function to execute config 2021-05-24 08:40:14 +02:00
carla
4040bb356d
loopout: refactor payInvoice to return more payment information
We're going to want more information about our failures going
forward, so we refactor payInvoice to return a full payment
status. The primary change in this commit is that we surface
both types of payment failures (result.err when we fail immediately,
and lnrpc.Failure when our payment is failed back) and return them
in the failure() method, rather than combining this information
at a lower level.
2021-05-24 08:40:13 +02:00
carla
9db8bd5f2a
loopout: do not reveal preimage if time to safe reveal has passed 2021-05-12 14:09:28 +02:00
Oliver Gugger
2a732a4385
loop: add initiator string to user agent 2020-11-06 10:43:03 +01:00
Oliver Gugger
38ddbfb45d
mod+loopin+loopout: update lndclient, add labels to TXs
We update to the latest lndclient that now requires a label when
publishing an on-chain transaction. Instead of just adding an empty
string, we use the proper labels added in a previous commit.
2020-10-15 10:40:12 +02:00
carla
7b56804bbe
multi: move label validation to rpc and simplify validation function
Previously labels with reserved prefixes were added to provide us
with a way to identify automatically dispatched loops. This commit moves
the validation of these labels to the rpc level so that it will only
apply to user-initiated swaps.
2020-10-12 13:34:52 +02:00
Andras Banki-Horvath
133f3cac5f multi: integrate the new htlc v2 scripts to loop in/out
This commit bumps the current protocol version and integrates htlc v2
with loop in/out for new swaps, while keeping htlc v1 for any pending
swaps with previous protocol versions.
2020-09-09 19:54:01 +02:00
András Bánki-Horváth
02a16d097e
Merge pull request #255 from bhandras/htlc_v2
preliminary work for integrating the v2 HTLC script
2020-08-27 16:50:05 +02:00
Andras Banki-Horvath
71a7dec649
sweeper: set sequence to be able to sweep htlc v2 utxo 2020-08-27 16:21:51 +02:00
Alex Bosworth
a47eacff62
loopout: Increase payment timeout
Allow for more time to search for low-routing fee pathways to the Loop service
2020-08-25 11:46:03 -07:00
Alex Bosworth
a29cb86b4a
Update loopout.go 2020-08-24 13:40:28 -07:00
Alex Bosworth
a9cbb34be0
loopout: Increase default sweep confirmation target
Now that the server supports a longer CLTV maximum, the default sweep target may be increased to allow for lower on-chain costs
2020-08-20 11:56:28 -07:00
carla
852f459391
multi: add htlc confirmations parameter to client loop out request 2020-08-04 20:29:09 +02:00
carla
1877b7f08b
multi: store loop out htlc confirmations on disk
To allow users to specify differing confirmation targets, we store the
swap conf target per-swap. This makes us restart safe, so we do not
forget confirmation values for swaps that are in flight when we restart.
2020-08-04 20:28:06 +02:00
carla
9678c7817d
multi: add swap label to SwapContract and store under separate key
This commits adds an optional label to our swaps, and writes it to
disk under a separate key in our swap bucket. This approach is chosen
rather than an on-the-fly addition to our existing swap contract field
so that we do not need to deal with EOF checking in the future. To allow
creation of unique internal labels, we add a reserved prefix which can
be used by the daemon to set labels that are distinct from client set
ones.
2020-08-03 10:55:58 +02:00
Joost Jager
43323ffbe2
loopout: extend htlc expiry based on conf target 2020-07-16 21:30:16 +02:00
carla
cd2b08aec6
multi: consume and log sever state updates 2020-07-16 21:02:06 +02:00
Joost Jager
1869ad670f
looprpc: expose server message to clients 2020-06-30 16:59:10 +02:00
Joost Jager
8b215edaa2
multi: create init result structs 2020-06-30 16:59:08 +02:00
Joost Jager
c6c30e2988
multi: log server message 2020-06-30 16:59:04 +02:00
Joost Jager
e22524a262
loopout: register for confirmation using htlc tx hash 2020-06-24 15:28:12 +02:00
Joost Jager
0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 2020-06-18 14:27:52 +02:00
carla
65c847674d
multi: add preimage push to loop out after sweep attempt
Once we have revealed our preimage to the world with a sweep attempt,
we can safely push our preimage to the server to speed up on chain
claim.

Rather than rely on the server, we use the state of our invoice in lnd
to determine whether we should continue trying to push the preimage to
the server.
2020-06-08 12:54:08 +02:00
Joost Jager
8c544bf2ba
loopdb: store outgoing channel set
Upgrade the database schema to allow for multiple outgoing channels.
This is implemented as an on-the-fly migration leaving the old key in
place.
2020-05-21 11:22:04 +02:00
Joost Jager
c62acd5b85
lndclient: add outgoing channel set restriction
Expose the channel set restriction that was introduced in LND 0.10.1 on
the proxy object.
2020-05-21 11:21:58 +02:00
Andras Banki-Horvath
f0aff9b7bd looprpc+loopin: support for native segwit htlcs
This commit extends SwapResponse and SwapStatus with np2wsh and p2wsh
htlc output addresses to support both nested and native segwit htlcs
in loop-in.

Furthermore the commit adds support for native segwith loop-in htlcs.
When the htlc is paid internally, as of this commit we'll use NP2WSH,
otherwise users are free to select whether to pay the NP2WSH or the
P2WSH htlc.
2020-05-05 15:49:05 +02:00
Andras Banki-Horvath
b2b0bad951 loopin+loopout: move htlc out of swapKit
This commit moves htlc out of swapkit in preparation of adding separate
p2wsh and np2wsh htlcs to loop-in swaps.
2020-05-04 23:18:14 +02:00
Joost Jager
12ae3d6a40
loopd: make maximum number of payment parts configurable 2020-04-27 16:32:12 +02:00
Joost Jager
65375723b4
lndclient: upgrade to lnd v0.10.0-beta-rc5 2020-04-27 16:30:42 +02:00
Joost Jager
4a714e0c96
Merge pull request #178 from joostjager/loopout-routerrpc
loopout: allow multi-loop
2020-04-20 10:13:58 +02:00
carla
1f5aeff45f
multi: unify default sweep/htlc conf targets
Create a HtlcConfTarget which is used as a default for quote
and loop in. Update loop out quote to use the existing var
rather than just 6 inline.
2020-04-17 09:40:18 +02:00
Joost Jager
6acd76e237
loopout: allow multi-loop 2020-04-16 16:45:01 +02:00
Joost Jager
710ae77750
loopout: log in-flight htlc status 2020-04-16 16:40:37 +02:00
Joost Jager
4039ba9b69
loopout: use routerrpc to send payments 2020-04-16 16:40:35 +02:00
Johan T. Halseth
c70d0deecb
swap_server_client: let the SwapPublicationDeadline be set during LoopOuts 2019-11-21 18:47:01 +01:00
Oliver Gugger
b574e344ea
multi: add persistent logger 2019-10-28 17:09:23 +01:00
Oliver Gugger
69f2af9fdc
loop+cmd: extract types into swap module 2019-10-09 16:14:06 +02:00
Wilmer Paulino
e0d23cb180
loopout: compare delta from htlc expiry correctly
This addresses an issue where using a sweep confirmation target greater
than the default would result in most cases not revealing the preimage
due to the default confirmation target yielding a higher fee than the
max miner fee backed by the confirmation target provided.
2019-10-02 11:07:07 -04:00
Alex Bosworth
6608337bb4
Merge pull request #71 from joostjager/address-estimate
multi: base sweep fee estimate on actually used address type
2019-07-31 09:30:18 -07:00
Bjorn Olav Jalborg
8d7a272fdd loop+loopout: validate hash of swap invoice
This commit fixes a possible exploit by the loop server, where
- in a loop out - the server could claim money off-chain, without
publishing an on-chain swap htlc.

The server could do this by responding with a regular invoice, whose hash
is different than the hash in the NewLoopOutSwap request. To prevent
the exploit, we validate that the hash of the swap invoice is equal to the
hash the client generated.
2019-07-31 11:01:42 +02:00
Joost Jager
ecd36b921c
multi: base sweep fee estimate on actually used address type 2019-07-30 13:59:34 +02:00
Joost Jager
b3b20fc66f
loopout: remove redundant type declaration 2019-07-30 13:59:33 +02:00
Wilmer Paulino
47321ba4a4
loop: use default confirmation target for htlc sweep after expiry delta
In this commit, we introduce a delta from the on-chain HTLC's
expiration. Since clients are now able to specify a confirmation target
for the HTLC sweep, it's possible that the sweep doesn't confirm within
the intended target in the event of an increasing demand for block
space. Once the delta from the HTLC's expiration is reached, we'll begin
to use the default sweep confirmation target when sweeping the HTLC,
which should provide a timely confirmation. This is needed because if
the preimage has already been revealed, then we need to make sure we
sweep the HTLC before the server does.
2019-07-10 18:00:48 -07:00
Wilmer Paulino
c16e170338
multi: expose confirmation target for loop out HTLC sweep 2019-07-10 18:00:47 -07:00
Joost Jager
6efa62347b
multi: store swap cost in database 2019-05-20 13:57:18 +02:00
Joost Jager
1b306ad425
loopdb: replace swap state enum by state data object
This commits lays down the foundation in the database for adding more
persistent state data to swaps.
2019-05-20 13:57:09 +02:00
Joost Jager
30c7d71c57
use np2wsh for loop in htlc 2019-04-04 15:49:02 +02:00
Joost Jager
3e960b8b54
multi: loop in swap 2019-03-28 11:56:49 +01:00