1
0
Commit Graph

19202 Commits

Author SHA1 Message Date
SomberNight
a7afd59dec swaps: more clean-up, add comments, more sanity checks 2025-08-23 02:41:43 +00:00
SomberNight
fc362826e8 swaps: clean-up onchain script construction 2025-08-23 02:41:40 +00:00
SomberNight
8d8d1dba0f util.format_satoshis: floating-point paranoia 2025-08-22 13:30:26 +00:00
ThomasV
44a95bafbe Merge pull request #10164 from f321x/proper_cleanup_after_swap_failed
swaps: cleanup data after swap gets failed
2025-08-22 15:20:47 +02:00
f321x
97a0d27fa6 swaps: cleanup after successful swap
unregister hold invoice callback and delete payment bundle. they are not
used anymore.
2025-08-22 12:52:43 +02:00
ThomasV
0949d9755c Merge pull request #10165 from spesmilo/swaps_prepayment
reverse swaps: in the CLI, replace 'server_mining_fee' with
2025-08-22 10:37:53 +02:00
ThomasV
13260ca498 Merge pull request #10167 from SomberNight/202508_cmd_format_satoshis
commands: use format_satoshis consistently. don't use sci-notation
2025-08-22 10:36:46 +02:00
ghost43
db1df37dda Merge pull request #10159 from SomberNight/202508_max_logfile_size
logging: add config.LOGS_MAX_TOTAL_SIZE_BYTES: to limit size on disk
2025-08-21 21:10:42 +00:00
ghost43
e6eb9f6cd2 Merge pull request #10166 from spesmilo/txbatcher_fix_to_sweep_now
txbatcher: to_sweep_now should be a list
2025-08-21 21:03:49 +00:00
f321x
c623cca654 swaps: cleanup data after swap gets failed
Removes the persisted payment info from lnworker once a swap got failed.
Stops persisting the OnionRoutingFailure as it is sufficient to delete
the payment info to fail potential incoming htlcs.
Deletes stored swap leftovers in lnworker and SwapManager
2025-08-21 19:56:42 +02:00
SomberNight
e5930dd5e6 trivial follow-up: add more type-hints 2025-08-21 17:48:38 +00:00
ThomasV
864932c79a reverse swaps: in the CLI, replace 'server_mining_fee' with
'prepayment', which corresponds to the trusted part of the
lightning payment.

We use 2*sm.mining_fee, where 'mining_fee' is the flat part of
the server fee. However, future protocol should probably allow
to set a value that does not depend on 'mining_fee'.
(note that LND uses a hardcoded amount).
2025-08-21 19:47:00 +02:00
ThomasV
08ea821221 txbatcher: to_sweep_now should be a list 2025-08-21 19:41:35 +02:00
SomberNight
c1d2fc2b42 lnworker: (trivial) get_payment_bundle to not return None 2025-08-21 17:39:31 +00:00
SomberNight
74cd2b4ac3 commands: use format_satoshis consistently. don't use sci-notation
old behaviour:
```
>>> from electrum.commands import format_satoshis
>>> format_satoshis(1)
'1E-8'
```
2025-08-21 17:38:27 +00:00
ThomasV
07d69bd876 Merge pull request #10161 from spesmilo/txbatcher_do_not_remove_local_tx
txbatcher: be careful when removing local transactions
2025-08-21 19:10:49 +02:00
SomberNight
6d99717d5b txbatcher: add comment to _to_pay_after 2025-08-21 15:15:08 +00:00
ghost43
139508e2b4 Merge pull request #10162 from f321x/prevent_swapserver_spam
swaps: rate limit swapserver requests
2025-08-21 13:52:02 +00:00
f321x
aa661da9e2 swaps: stop sending whole req exception to client 2025-08-21 14:41:47 +02:00
f321x
9086f1af14 swaps: rate limit swapserver requests 2025-08-21 14:41:36 +02:00
ghost43
d7fe5fb46d Merge pull request #10158 from f321x/command_fetch_swap_providers
commands: add command to fetch nostr swap providers
2025-08-21 12:29:10 +00:00
f321x
990a56b9dc tests: regtest: add swapserver mining fee argument 2025-08-21 14:23:26 +02:00
f321x
8c8d142307 tests: unittest get_submarine_swap_providers cli 2025-08-21 14:23:24 +02:00
f321x
5bb9b71bae commands: add command to fetch nostr swap providers 2025-08-21 14:23:20 +02:00
ThomasV
5f30f2a0c0 txbatcher: be careful when removing local transactions
1. Do not remove local transaction in find_base_tx.

This logic was intended to cleanup claim transactions that are
never broadcast (for example, if the counterparty gets a refund)
(see 1bf1de36cb)

However, this code is too unspecific and may result in fund loss,
because the transaction being removed may contain outgoing payments.
For example, if the electrum server is not responsive, the tx will
be seen as local and deleted. In that case, another payment will
be attempted, thus paying twice.

2. Do not remove tx after try_broadcasting returns False.

The server might be lying to us. We can only remove the local tx
if there is a base_tx, because the next tx we create will try to
spend the same output.
2025-08-21 10:26:35 +02:00
ghost43
e85a3f2d3f Merge pull request #10157 from SomberNight/202508_swap_sanity_check_costs
swaps: add sanity-check for total swap costs
2025-08-20 18:05:13 +00:00
SomberNight
7046a7e786 logging: add config.LOGS_MAX_TOTAL_SIZE_BYTES: to limit size on disk 2025-08-20 17:57:05 +00:00
ghost43
7e743b7998 Merge pull request #10156 from f321x/improve_reverse_swap_mining_fee
swaps: add sanity check to reverse swap mining fee
2025-08-20 16:22:54 +00:00
SomberNight
2f1e373077 commands: reverse_swap: don't require provider_mining_fee in dryrun 2025-08-20 16:20:52 +00:00
f321x
71c71a96f3 swaps: add sanity check to reverse swap mining fee 2025-08-20 17:57:36 +02:00
SomberNight
bb39ca5595 swaps: add sanity-check for total swap costs 2025-08-20 15:13:25 +00:00
ghost43
a29125f5c5 Merge pull request #10153 from SomberNight/202508_lnpeer_rate_limits
lnpeer: add some rate-limits
2025-08-20 12:28:50 +00:00
ThomasV
5553d5aa86 Merge pull request #10152 from SomberNight/202508_swaps_dm_replies
swaps: nostr: add sanity checks for replies
2025-08-20 12:37:41 +02:00
ThomasV
dad6d51e85 Merge pull request #10155 from f321x/swap_prepayment_fix
swaps: improve prepayment invoice handling
2025-08-20 12:35:42 +02:00
f321x
04b0aca878 swaps: improve prepayment invoice handling 2025-08-20 12:04:44 +02:00
SomberNight
df96f87ed7 lnworker: limit max number of incoming channel-less peers 2025-08-19 18:28:16 +00:00
SomberNight
1380ed4ba7 lnpeer: rate-limit ordered_message_queues 2025-08-19 18:28:13 +00:00
SomberNight
b8d989e13b lnpeer: rate-limit reply_channel_range 2025-08-19 18:28:09 +00:00
SomberNight
65d04dfbb7 lnpeer: slow down peers sending too much gossip 2025-08-19 18:28:01 +00:00
SomberNight
93e0e8a7b8 swaps: nostr: add sanity checks for replies 2025-08-19 16:38:27 +00:00
ghost43
da9b921f57 Merge pull request #10151 from spesmilo/dm_replies_no_defaultdict
submarine_swaps: use dict instead of defaultdict for dm_replies
2025-08-19 16:04:28 +00:00
ThomasV
eae6ddd773 submarine_swaps: use dict instead of defaultdict for dm_replies 2025-08-19 17:54:25 +02:00
ghost43
fc3aa2e8ee Merge pull request #10150 from SomberNight/202508_swaps_parsing
swaps: more robust parsing
2025-08-19 14:35:57 +00:00
SomberNight
81be0554a3 swaps: more robust parsing 2025-08-19 13:42:21 +00:00
ghost43
5b8569e814 Merge pull request #10149 from f321x/improve_swaps_send_dm
swaps: make NostrTransport.send_direct_message() more robust
2025-08-19 13:35:47 +00:00
f321x
37614e9092 swaps: handle timeouts in send_direct_message
Adds logic to retry sending a direct message in
`NostrTransport.send_direct_message()` on `TimeoutError`.
Handles `TimeoutError` exception more gracefully by catching it and
returning `None`.
2025-08-19 15:29:58 +02:00
Sander van Grieken
e90534beaa fee_policy: use FEERATE_PRECISION for .. precision 2025-08-19 14:16:32 +02:00
ThomasV
6ffaa55813 lnwatcher: early return in sweep_commitment_transaction if chan.need_to_subscribe returns False 2025-08-19 14:06:22 +02:00
SomberNight
74d2c6386a wallet: sweep_preparations to raise UserFacingException on p2sh/etc
closes https://github.com/spesmilo/electrum/issues/10145
2025-08-18 17:02:34 +00:00
ghost43
e7c8377808 Merge pull request #10128 from f321x/fix_4111
fix: psbt_nostr: don't save tx without txid
2025-08-18 16:30:16 +00:00