Commit Graph

14 Commits (43cff31297185807710347d66e2efede3c89c8c9)

Author SHA1 Message Date
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