Commit Graph

65 Commits (11ab596080e9d36f1df43edbeba0702b25aa7457)

Author SHA1 Message Date
Andras Banki-Horvath 5d7b0abdf5
loopout: add unit test for the MuSig2 sweep case 2 years ago
Andras Banki-Horvath 82b58e5c0e
loopout: attempt cooperative musig2 sweep
This commit adds optional cooperative musig2 sweep by calling the server
to create a partial signature for the sweep if we'd otherwise be allowed
to spend the htlc. If the cooperative musig2 spend fails, we always fall
back to use the scriptpath spend.
2 years ago
Andras Banki-Horvath a252e2c706
loopdb: add the local pubkey's keylocator to the persisted contract 2 years ago
Andras Banki-Horvath 391ef57ea3
loopout: enable p2tr without keyspend 2 years ago
Andras Banki-Horvath 00cf4bf71c
multi: make the next protocol version optional 2 years ago
Carla Kirk-Cohen c7ef4297c0
multi: update sweeping to allow different sighashes and claim scripts
Taproot spends require a different sighash, so we update our HtlcScript
interface to provide the appropriate sighash when sweeping. We also add
distinct Timeout/Success Script functions to allow for tapleaf spends
which have different locking scripts for different paths. Note that the
timeout and success paths will be the same for segwit v0 htlcs, because
it has a single branched script containing all spend paths.

In future iterations, this differentiation of claim scripts can also
be used to use musig2 to collaboratively keyspend P2TR htlcs with the
server. This script can be expressed as PriorityScript (because we'll
try to keyspend as a priority, and then fall back to a tap leaf spend).
As we've done here, segwit v0 spends would just return their single
script for PriorityScript, and the claim would be no different from
our other claims.
2 years ago
sputn1ck efb6f75d60
swap: add lasthop, outgoingchanids to swapinfo 2 years ago
Carsten Otto b0044e0994 loopout: remove double space in log message 2 years ago
Harsha Goli 7a16e3b25d
multi: bump btcec/v2 and btcutil to new versions 2 years ago
Andras Banki-Horvath 32d55dc814
loopout: do not report prepays and fix plugin type if acquire fails 2 years ago
Andras Banki-Horvath ffd52aba2f
loopout: add low/high routing plugin 2 years ago
Andras Banki-Horvath 1d1354d2cb
config: make total payment timeout and retries configurable 2 years ago
Andras Banki-Horvath 1943edfd78
loopout: use optional routing plugin for the main swap invoice 2 years ago
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.
3 years ago
carla f166ce899d
loopout: cancel swap with server when off-chain fails 3 years ago
carla 16111352a8
multi: add cancel swap function to execute config 3 years ago
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.
3 years ago
carla 9db8bd5f2a
loopout: do not reveal preimage if time to safe reveal has passed 3 years ago
Oliver Gugger 2a732a4385
loop: add initiator string to user agent 4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
András Bánki-Horváth 02a16d097e
Merge pull request #255 from bhandras/htlc_v2
preliminary work for integrating the v2 HTLC script
4 years ago
Andras Banki-Horvath 71a7dec649
sweeper: set sequence to be able to sweep htlc v2 utxo 4 years ago
Alex Bosworth a47eacff62
loopout: Increase payment timeout
Allow for more time to search for low-routing fee pathways to the Loop service
4 years ago
Alex Bosworth a29cb86b4a
Update loopout.go 4 years ago
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
4 years ago
carla 852f459391
multi: add htlc confirmations parameter to client loop out request 4 years ago
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.
4 years ago
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.
4 years ago
Joost Jager 43323ffbe2
loopout: extend htlc expiry based on conf target 4 years ago
carla cd2b08aec6
multi: consume and log sever state updates 4 years ago
Joost Jager 1869ad670f
looprpc: expose server message to clients 4 years ago
Joost Jager 8b215edaa2
multi: create init result structs 4 years ago
Joost Jager c6c30e2988
multi: log server message 4 years ago
Joost Jager e22524a262
loopout: register for confirmation using htlc tx hash 4 years ago
Joost Jager 0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
Joost Jager 12ae3d6a40
loopd: make maximum number of payment parts configurable 4 years ago
Joost Jager 65375723b4
lndclient: upgrade to lnd v0.10.0-beta-rc5 4 years ago
Joost Jager 4a714e0c96
Merge pull request #178 from joostjager/loopout-routerrpc
loopout: allow multi-loop
4 years ago
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.
4 years ago
Joost Jager 6acd76e237
loopout: allow multi-loop 4 years ago
Joost Jager 710ae77750
loopout: log in-flight htlc status 4 years ago
Joost Jager 4039ba9b69
loopout: use routerrpc to send payments 4 years ago
Johan T. Halseth c70d0deecb
swap_server_client: let the SwapPublicationDeadline be set during LoopOuts 5 years ago