Commit Graph

204 Commits

Author SHA1 Message Date
f321x
07a40b1c53 Improve accuracy of swapserver liquidity announcement.
Adds event handler and more calls to the liquidity update trigger to
ensure that changes in liquidity will get published more reliably.
2025-05-19 09:52:53 +02:00
SomberNight
44f3444795 lnworker: make "preimages" dict private
I want to hook into lnworker.save_preimage (not done yet).
Other modules should not put preimages into the dict directly.
2025-05-14 13:23:02 +00:00
ThomasV
6e3f173a71 SweepInfo: define csv_delay as property 2025-05-13 08:50:33 +02:00
ThomasV
db271d9b7d Fix get_pending_swaps: use both funding and spending tx heights
Also, do not show closing warnings if we are offline.
2025-05-08 14:58:13 +02:00
f321x
913f5ec6d8 add option to show warnings on wallet close, add warning for ongoing submarine swap 2025-05-07 17:11:08 +02:00
ThomasV
1c3268c2ff submarine_swaps: make callback async (follow-up previous commit) 2025-05-06 13:03:38 +02:00
accumulator
80e7dce539 Merge pull request #9736 from f321x/swapserver_show_amounts
swaps: show swap limits in SwapDialog
2025-04-28 21:59:33 +02:00
accumulator
a7ce107f01 Merge pull request #9737 from f321x/fix_swap_pay_invoice
swaps: don't limit attempts when paying swap invoice
2025-04-28 21:50:23 +02:00
SomberNight
5f83fffd2e swaps.py: (trivial) fix stale type-hint 2025-04-17 17:13:21 +00:00
f321x
6bdedb3ecd don't limit attempts when paying swap invoice 2025-04-15 15:53:31 +02:00
f321x
48bf7ee2b5 Show swap limits in SwapDialog 2025-04-15 13:06:57 +02:00
ThomasV
4ecf6acc1c Merge pull request #9691 from f321x/send_change_to_lightning
swaps: improve send change to lightning and swapserver error handling
2025-04-09 13:18:54 +02:00
f321x
c27035219a Set log level of logger passed to the aionostr.Manager to INFO because the debug log output of Manager is very verbose (showing single websocket messages etc.). This still provides enough useful information for debugging purposes. 2025-04-09 12:26:28 +02:00
ThomasV
fe11fa3f4f Merge pull request #9716 from f321x/fix_swap_exception
swaps: make swap transport use shared timeout value
2025-04-09 12:06:52 +02:00
SomberNight
4b9d874d13 util: add fn run_sync_function_on_asyncio_thread
note: the return value is not propagated out.
It would be trivial to do that for the block=True case - but what about block=False?
2025-04-08 19:53:49 +00:00
f321x
216bfe3b50 fix race condition causing initialize_swap_manager assert to fail by waiting for trigger_pairs_updated_threadsafe to set the is_initialized event before returning if it is not running on the aio loop 2025-04-08 19:00:05 +02:00
f321x
aace9aab91 make swap transport use shared timeout value 2025-04-08 17:44:17 +02:00
ThomasV
282c4561ff swapsserver fix for legacy clients. (follow-up 6e92a00) 2025-04-05 18:17:06 +02:00
f321x
6e8bdb346a move onchain balance calculation to wallet.py 2025-04-04 15:08:51 +02:00
f321x
17a9a91e1f announce actual available liquidity as swap provider 2025-04-04 15:06:50 +02:00
ThomasV
cb75f21f3b Merge pull request #9640 from f321x/swap_dm_relays
swaps: Update submarine swap nostr relays dynamically and remove redundant query
2025-04-03 13:34:54 +02:00
f321x
4490bd3a76 improve send change to lightning and swapserver error handling 2025-04-02 12:58:27 +02:00
ThomasV
6e92a00ec4 Remove zeroconf option for submarine swaps
Since we now accept random swap providers, it is unreasonable
to keep that option.
2025-03-21 18:18:27 +01:00
f321x
21e3fd91dd dynamically update relays and remove redundant nostr query, store last
swapserver relays in file
2025-03-21 09:31:50 +01:00
f321x
9c7773c8db use ephemeral event type for nostr swap request events 2025-03-20 09:43:48 +01:00
ThomasV
1e4728bdf1 Merge pull request #9560 from f321x/nostr_proxy
Pass proxy settings to aionostr manager for submarine swaps
2025-03-19 14:26:27 +01:00
ThomasV
26910ef81d Merge pull request #9620 from accumulator/lightning_pass_invoice_not_bolt11
refactor lnworker.pay_invoice to accept Invoice object instead of bolt11 string
2025-03-18 20:09:01 +01:00
ThomasV
3463e68306 add accounting addresses 2025-03-17 10:47:19 +01:00
SomberNight
977d8b1dd6 wallet: kill create_transaction 2025-03-14 17:19:41 +00:00
SomberNight
3c3778db9c wallet: towards killing create_transaction: rm "sign" arg 2025-03-14 16:44:46 +00:00
ThomasV
fbebe7de1a Make lnwatcher not async
This fixes offline history not having the proper labels
2025-03-14 11:09:11 +01:00
ThomasV
42b072aca8 submarine swaps: formatting 2025-03-14 09:22:32 +01:00
ThomasV
fff90a1426 submarine swaps: check preimage before labeling a refund transaction 2025-03-14 09:13:18 +01:00
ThomasV
b64109ea88 swaps: set locktime to None instead of zero, so that anti fee-sniping works 2025-03-13 12:46:13 +01:00
ThomasV
bdb7a82220 batch payment manager:
The class TxBatcher handles the creation, broadcast and replacement
of replaceable transactions. Callers (LNWatcher, SwapManager) use
methods add_payment_output and add_sweep_info. Transactions
created by TxBatcher may combine sweeps and outgoing payments.

Transactions created by TxBatcher will have their fee bumped
automatically (this was only the case for sweeps before).

TxBatcher manages several TxBatches. TxBatches are created
dynamically when needed.

The GUI does not touch txbatcher transactions:
  - wallet.get_candidates_for_batching excludes txbatcher
    transactions
  - RBF dialogs do not work with txbatcher transactions

wallet:
  - instead of reading config variables, make_unsigned_transaction
    takes new parameters: base_tx, send_change_to_lighting

tests:
  - unit tests in test_txbatcher.py (replaces test_sswaps.py)
  - force all regtests to use MPP, so that we sweep transactions
    with several HTLCs. This forces the payment manager to aggregate
    first-stage HTLC tx inputs. second-stage are not batched for now.
2025-03-13 10:17:10 +01:00
SomberNight
57452d6cd5 lnutil: rm duplication of htlc witness script templates 2025-03-12 17:17:14 +00:00
f321x
2290650faa pass proxy settings to aionostr Manager
rebase on master
2025-03-10 10:57:30 +01:00
Sander van Grieken
6fdb6c93f7 refactor lnworker.pay_invoice to accept Invoice object instead of bolt11 string
rename lnworker._check_invoice to lnworker._check_bolt11_invoice
2025-03-09 14:47:34 +01:00
ThomasV
840243e029 separate fee policy from config
- Wallet.make_unsigned_transaction takes a FeePolicy parameter
 - fee sliders act on a FeePolicy instead of config
 - different fee policies may be used for different purposes
 - do not detect dust outputs in lnsweep, delegate that to lnwatcher
2025-03-05 10:29:26 +01:00
ThomasV
0e40be5fb5 swaps: replace request_swap_for_tx with request_swap_for_amount,
as this uses less side effects

(change backported from batch_payment_manager)
2025-03-03 14:02:29 +01:00
f321x
6f97b7b5f9 simplify submarine swap onchain fee model to single base fee 2025-02-20 16:51:48 +01:00
ThomasV
392c219913 simplify history-related commands:
- reduce number of methods
 - use nametuples instead of dicts
 - only two types: OnchainHistoryItem and LightningHistoryItem
 - channel open/closes are groups
 - move capital gains into separate RPC
2025-02-19 11:40:21 +01:00
ThomasV
18baf003d4 submarine swaps: backport changes from batch_payment_manager
- add 'is_funded' method to SwapData
 - sign claim transactions using the 'make_witness' method
2025-02-15 10:29:19 +01:00
SomberNight
2d8c26f211 qt swaps: fix _spend_max_reverse_swap: round down msats
Clicking "max" btn for a reverse swap was setting the text field to a too high value.

```
>>> wallet.lnworker.num_sats_can_send()
Decimal('1242647.947')
>>> util.format_satoshis_plain(Decimal('1242647.947'))
'0.01242648'
```
2025-02-14 14:33:51 +00:00
SomberNight
6749468866 swaps: add base class for transports. move "get_recent_offers" logic
the "get_recent_offers" logic is now shared between the GUIs
2025-02-14 14:10:24 +00:00
Sander van Grieken
993a575b7f submarine_swaps: implement swaps-over-nostr for qml 2025-02-14 09:54:09 +01:00
f321x
a47421490d increase nonce size to 32 byte and make it hex in event 2025-02-12 10:09:11 +01:00
f321x
947094c1b0 add pow, more default relays, new event type 2025-02-11 18:16:15 +01:00
ThomasV
0ef7235147 swaps: ignore exceptions in publish_offers
nostr may temporarily raise an exception; we don't want to kill the taskgroup
2025-01-16 09:51:26 +01:00
ThomasV
0efe7e9bc8 swaps: make the zeroconf option non-persisted
Since we allow swaps with random servers, we should not persist that setting.
2025-01-10 16:19:01 +01:00