Commit Graph

16914 Commits

Author SHA1 Message Date
SomberNight 65394c37d5 wallet.make_unsigned_transaction: add batch_rbf/send_change params
Don't side-effect config just to modify the next call of make_unsigned_transaction >.<
Cleaner to pass parameters.
2023-10-10 17:13:18 +00:00
SomberNight bfba0dba56 storage: make partial writes pos sanity-check more robust
The return value of f.write and f.seek cannot be compared when using open() in text mode:
```
>>> import os
>>> s = "aá"
>>>
>>> with open("a1", "w", encoding='utf-8') as f:
...   a = f.write(s)
...   pos = f.seek(0, os.SEEK_END)
...   print(a, pos)
...
2 3
>>>
>>> with open("a2", "wb") as f:
...   a = f.write(s.encode('utf-8'))
...   pos = f.seek(0, os.SEEK_END)
...   print(a, pos)
...
3 3
```

Was getting errors on Windows, probably due to `\r\n` vs `\n`?
```
20231010T121334.522573Z |    ERROR | util.CallbackManager | cb errored. event='adb_set_up_to_date'. exc=AssertionError((2471475, 2522998))
Traceback (most recent call last):
  File "...\electrum\electrum\wallet.py", line 497, in on_event_adb_set_up_to_date
    self.save_db()
  File "...\electrum\electrum\wallet.py", line 403, in save_db
    self.db.write()
  File "...\electrum\electrum\json_db.py", line 48, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\json_db.py", line 389, in write
    self._append_pending_changes()
  File "...\electrum\electrum\json_db.py", line 48, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\json_db.py", line 400, in _append_pending_changes
    self.storage.append(s)
  File "...\electrum\electrum\storage.py", line 110, in append
    assert pos == self.pos, (self.pos, pos)
AssertionError: (2471475, 2522998)
```
2023-10-10 14:33:22 +00:00
SomberNight 63143307f1 config: follow-up rename of FEE_EST_STATIC_FEERATE
follow-up 455167136d
2023-10-10 12:11:45 +00:00
ThomasV 57c9059cab open_channel_with_peer: return funding tx
(this makes things easier the just_in_time_channels branch)
2023-10-09 17:02:19 +02:00
ThomasV 2f8325ca09 follow-up 455167136d (variable rename) 2023-10-09 12:31:23 +02:00
ThomasV f6bebec0a5 follow-up prev commit (variable rename) 2023-10-09 12:19:23 +02:00
ThomasV 455167136d CLI: new getfeerate/setfeerate API 2023-10-09 12:14:39 +02:00
ThomasV e2fb928e4f delete htlc session keys once they are no longer needed.
fixes #8630

Note: maybe we should plan a WalletDB upgrade to cleanup
existing wallets.
2023-10-08 15:52:41 +02:00
ThomasV 4e76ed6952 move INITIAL_TRAMPOLINE_FEE_LEVEL to config 2023-10-08 15:06:19 +02:00
ThomasV 8acb5dd7e9 CI: run unit tests in debug mode with python 3.11
Python 3.12 does not work with current aiohttp, see
https://github.com/aio-libs/aiohttp/issues/7229

It is currently possible to build a wheel using aiohttp==3.9.0b0.
However, unit tests fail in that case, because TestLNTransport::test_loop stalls.
2023-10-08 11:43:55 +02:00
ThomasV 3249e924d4 follow-up previous commit 2023-10-08 10:39:42 +02:00
ThomasV 2e52b17a43 CLI: replace the 'unlock' command with an option passed to load_wallet
Some use cases require the wallet to be unlocked at load time.
2023-10-08 10:21:01 +02:00
ThomasV 535f7cdcb7 follow-up previous commit 2023-10-07 17:03:13 +02:00
ThomasV 695fe004b0 setconfig: do not return 'true'
not useful (we have type checking) and sometimes confusing
(for example, when you set something to 'false')
2023-10-07 16:51:59 +02:00
ThomasV 16ef287e86 swap server: try to batch funding transactions 2023-10-07 13:26:07 +02:00
Sander van Grieken cbcafe8960 qml: remove redundant WalletDB, closes #8628 2023-10-06 12:06:00 +02:00
Sander van Grieken e4f9cfb1cc qt: clipboard might have been changed after show menu. add check. fixes #6526 2023-10-06 11:13:16 +02:00
ThomasV 40eba6f780 submarine swaps: improve labels
- claim tx was incorrectly labeled
 - if we send tx change to a swap, display both labels
2023-10-05 15:41:04 +02:00
Sander van Grieken 9ed5f7bf43 qml: don't show "select server automatically" checkbox in network setup wizard 2023-10-05 11:01:29 +02:00
ThomasV 6de40321c5 rbf batching: make sure new feerate > old feerate
The previous lower bound did not ensure that, sometimes
resulting in tx rejection. Note, though, that BIP125 does
not explicitly state that the new feerate must be strictly
higher than the old feerate.
2023-10-04 11:57:26 +02:00
Sander van Grieken f7bf4e146d payment_identifier: move adding openalias to contacts out of _do_resolve.
This fixes "cannot pickle '_thread.RLock' object" when paying from Contacts tab
2023-10-03 11:42:12 +02:00
Sander van Grieken 1ea1a70099 partial-writes: add missing package pins 2023-10-02 14:11:23 +02:00
Sander van Grieken 67b0fa2047 qml: add extra parent_fee check. fixes #8634 2023-10-02 09:29:46 +02:00
Sander van Grieken b12c3233e5 qml: followup 5acfe418079dbc9935cf9576e50ae2c8c841e301; don't save expiry Never as default. 2023-09-30 14:45:42 +02:00
Sander van Grieken b8b5dab68a qml: properly return when current wallet is selected from wallets list 2023-09-30 14:43:11 +02:00
ThomasV 5acfe41807 qml: add never-expiring requests. fixes #8631 2023-09-30 09:46:16 +02:00
ThomasV 9ebae958dc text gui: fix WalletDB 2023-09-30 09:34:34 +02:00
Alef Farah cf4590bee3 fix recv for text gui 2023-09-29 17:35:42 -03:00
ThomasV 98cecb305e jsondb: raise an exception if a daemon thread attempts to write 2023-09-28 18:33:56 +02:00
ThomasV 71d6cc0b35 lnpeer: split 'pay' method into 'create_onion_for_route'
and 'send_htlc'

This will be useful for just_in_time channels, as we will need
to create an onion before the channel object is available.
2023-09-28 10:35:15 +02:00
ThomasV 1af6972d03 Merge pull request #8493 from spesmilo/jsonpatch_new
partial-writes using jsonpatch
2023-09-28 09:23:14 +02:00
ThomasV d79a4a0380 Merge pull request #8623 from accumulator/qml_sign_verify
qml: add message sign/verify
2023-09-28 09:20:10 +02:00
ThomasV 20416ba387 Merge pull request #8627 from qqux/master
Cleanup block explorer list
2023-09-28 09:15:51 +02:00
qqux 7429c29a37 Cleanup block explorers 2023-09-27 23:37:36 +00:00
Sander van Grieken e5e1e46b7b qml: add message sign/verify 2023-09-26 11:28:55 +02:00
ThomasV 4bfd3b2f46 test_lnpeer:
- do not use needs_test_with_all_chacha20_implementation,
   this is slow and not really useful here.
 - split TestPeer class in two classes, depending on the type
   of graph we use.
2023-09-26 10:44:43 +02:00
ThomasV e206d264c8 trampoline forwarding: use routing hints
unit tests:
 - remove 'drop_dave' flag, replace it by depleted channel
 - add test for trampoline forwarding using routing hints
 - lower attempts to 2
2023-09-26 10:07:41 +02:00
Sander van Grieken b846eabb70 qml: clicking on one of your own addresses on TxDetails page now takes you to AddressDetails page. 2023-09-25 17:53:18 +02:00
Sander van Grieken 3ff588049e payment_identifier: output is only considered a script if written as call-like 'script(<script>)' 2023-09-25 17:15:00 +02:00
Sander van Grieken 05a34fbe24 qml: tap-on-background now removes focus, allowing convenient way to hide keyboard 2023-09-25 16:58:27 +02:00
Sander van Grieken 6222b5ad40 followup 94a6f6cd0e 2023-09-25 16:10:19 +02:00
Sander van Grieken 94a6f6cd0e coldcard: don't raise when get_soft_device_id can't get xpub.
This allows uninitialized coldcards to show up in the device list.
2023-09-25 16:07:18 +02:00
SomberNight e346d36851 bump libsecp256k1 version 2023-09-25 13:11:03 +00:00
ThomasV c495445f51 storage: remember file length when writing to file
- make append fail if the actual file length differs
 - consolidate when file length > 2 * last consolidated length
2023-09-24 12:24:21 +02:00
ThomasV 35a86ec5aa qt console history: ensure partial writes 2023-09-24 12:24:21 +02:00
ThomasV 64cd816a82 json_db: recover corrupt db from incomplete file appends 2023-09-24 12:24:21 +02:00
ThomasV 7ca89f56ee partial-writes using jsonpatch
- partial writes are append only.

 - StoredDict objects will append partial writes to the wallet
   file when items are added, replaced, removed.

 - Lists in the wallet file that have not been registered
   as StoredObject are converted to StoredList, which
   overloads append() and remove(). Those methods too will
   append partial writes to the wallet file.

 - Unlike the old jsonpatch branch, this branch does not support
   file encryption. Encrypted files always fully rewritten, even
   if the change before encryption is a partial write.
2023-09-24 12:24:09 +02:00
ThomasV 019be008d6 json_db: do not overload load_data.
instead, pass an upgrader function to the constructor.
2023-09-24 12:10:35 +02:00
SomberNight 4978d40956 qt gui __init__: restore import order - raise pyqt5 missing early
follow-up https://github.com/spesmilo/electrum/pull/8560
2023-09-24 02:31:25 +00:00
ThomasV 4cc3c704b2 QML: Check passwords with WalletDB instances that have no storage,
to avoid unwanted side effects.

In qedaemon, call load_wallet with upgrade=True when loading a
wallet. Apparently, this was not done before; db upgrades were
performed as a side-effect of password verification...
2023-09-23 15:15:48 +02:00