Commit Graph

44 Commits (c8666caf2044534a0d7d00fa10650e1fba2355ab)

Author SHA1 Message Date
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 4 years ago
Oliver Gugger b574e344ea
multi: add persistent logger 4 years ago
Oliver Gugger 69f2af9fdc
loop+cmd: extract types into swap module 5 years ago
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.
5 years ago
Alex Bosworth 6608337bb4
Merge pull request #71 from joostjager/address-estimate
multi: base sweep fee estimate on actually used address type
5 years ago
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.
5 years ago
Joost Jager ecd36b921c
multi: base sweep fee estimate on actually used address type 5 years ago
Joost Jager b3b20fc66f
loopout: remove redundant type declaration 5 years ago
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.
5 years ago
Wilmer Paulino c16e170338
multi: expose confirmation target for loop out HTLC sweep 5 years ago
Joost Jager 6efa62347b
multi: store swap cost in database 5 years ago
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.
5 years ago
Joost Jager 30c7d71c57
use np2wsh for loop in htlc 5 years ago
Joost Jager 3e960b8b54
multi: loop in swap 5 years ago
Joost Jager 6a0a9556a0
loopdb: add loop in
This commit adds the required code to persist loop in swaps. It also
introduces the file loop.go to which shared code is moved.

Sharing of contract serialization/deserialization code has been
reverted. The prepay fields do not apply to loop in, but were part of
the shared contract struct. Without also adding a migration, it wouldn't
be possible to keep the shared code.

In general it is probably more flexible to keep the contract
serialization code separated between in and out swaps.
5 years ago
Olaoluwa Osuntokun 94f347e673
multi: finalize rename from uncharge to loop out 5 years ago