Commit Graph

82 Commits (master)

Author SHA1 Message Date
Slyghtning 1cea76bf01
loopout: send prepay over outgoing chan set 2 weeks ago
Andras Banki-Horvath 06fd21fd05
loop: fill the correct HTLC in loopout update 1 month ago
Andras Banki-Horvath 5294b4ff07
loop: clean up server cost calculation for slightly better UX
Previously we'd calculate the server costs (swap fees) by accounting for
both the on-chain HTLC and the off-chain payment which was confusing as
server cost fluctuated by the amount of the swap itself. Now we'll only
add the actual cost when the swap happened, so the server cost will go
form zero to the actual fee value paid.
2 months ago
Andras Banki-Horvath e1ddb50dfe
loopout+sweepbatcher: calculate the per sweep onchain fees correctly
Previously we'd report the fees per sweep as the total sweep cost of a
batch. With this change the reported cost will be the proportional fee
which should be equal for all sweeps except if there's any rounding
difference in which case that is paid by the sweep belonging to the
first input of the batch tx.
2 months ago
George Tsagkarelis 0914074b10
loop: integrate sweepbatcher to loopout flow 3 months ago
George Tsagkarelis b43fa11cc1
utils: add htlc & swap related helpers 3 months ago
George Tsagkarelis a9be69b281
multi: use isExternalAddr flag 3 months ago
GoodDaisy e45101cccd chore: fix typos 5 months ago
George Tsagkarelis 2a8a6cefc0
loop: fix musig2 typo 9 months ago
sputn1ck becc8a38d8
multi: use context in loopdb call
This commit adds a context to our loopdb interface, which we should use
in the sqlite migration.
10 months ago
Andras Banki-Horvath cd91f90ed2
loop: use MuSig2 1.0 scheme for the new MuSig2 swaps 1 year ago
Andras Banki-Horvath da4bcbea10
loopdb: refactor the SwapContract to hold all HTLC keys
This commit adds a new struct to hold all HTLC keys and refactors the
SwapContract which is used by both loopin and loopout swaps to use this
new struct. The newly added internal keys will for now hold the script
keys to keep everything equivalent but are already stored and read back
if the protocol version is set to MuSig2.
1 year ago
Andras Banki-Horvath a7451622e5
mod: bump LND and lndclient to include musig2 1.0rc2 changes
This commit bumps LND and lndclient to make it possible to upgrade
taproot HTLC construction with a MuSig2 version. This is required to
support both old (MuSig2 0.4) and new (MuSig2 1.0) clients.
1 year ago
sputn1ck 4baf88c414
multi: fix linter issues
This commit fixes outstanding linter issues, that we're not found by
running `make lint` locally. The linter issues were found by running
`docker run -v $(pwd):/build loop-tools golangci-lint run --whole-files`

I added the `revive` to the excludes as it would be to much of a
refactor and IMO seems unneccesary. E.g.
`interface.go:222:6: exported: type name will be used as
loop.LoopInTerms by other packages, and that stutters; consider
 calling this InTerms (revive)`. I think `loop.LoopInTerms` is fine.
1 year ago
Andras Banki-Horvath bdb4b773ed
swap: refactor htlc construction to allow passing of internal keys
This commit is a refactor of how we construct htlcs to make it possible
to pass in internal keys for the sender and receiver when creating P2TR
htlcs. Furthermore the commit also cleans up constructors to not pass in
script versions and output types to make the code more readable.
1 year ago
Andras Banki-Horvath a9dbaee102
loopout: log failed sweeps to allow out of band publish 2 years ago
Andras Banki-Horvath f8da106338
loopout: use psbt when obtaining the MuSig2 signature
In this commit we deprecate the sighash field from the
MuSig2SignSweepReq request in favour of using a psbt serialized sweep
transaction instead. This way the sever gains full transparency about
client sweep requests and can assemble the sighash to sign on its own.
2 years ago
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