Commit Graph

655 Commits

Author SHA1 Message Date
SomberNight
0a3e286f1d qt tx dialog: show_qr to warn if QR code is missing data
When exporting a tx as qr code, the prev txs are omitted to save space.
This causes problems with offline signers: software electrum signers will
just warn and then proceed, but hw devices will typically error.
2023-03-30 14:32:31 +00:00
SomberNight
04df286519 interface: fix ServerAddr.from_str_with_inference() for raw IPv6 addr
and add tests
2023-03-30 00:59:13 +00:00
SomberNight
11f06d860e tests: add more tests for daemon.update_password_for_directory 2023-03-20 20:05:31 +00:00
SomberNight
aac9afa7c1 tests: add a failing testcase for daemon.update_password_for_directory
related https://github.com/spesmilo/electrum/issues/8259
2023-03-20 20:05:21 +00:00
SomberNight
a30cda4ebd lnutil: test ImportedChannelBackupStorage.from_bytes
regression test - we should not inadvertently break deserialising existing backups
2023-03-19 19:15:44 +00:00
SomberNight
81772faf6c wallet: add_input_info to no longer do network requests
- wallet.add_input_info() previously had a fallback to download parent
  prev txs from the network (after a lookup in wallet.db failed).
  wallet.add_input_info() is not async, so the network request cannot
  be done cleanly there and was really just a hack.
- tx.add_info_from_wallet() calls wallet.add_input_info() on each txin,
  in which case these network requests were done sequentially, not concurrently
- the network part of wallet.add_input_info() is now split out into new method:
  txin.add_info_from_network()
- in addition to tx.add_info_from_wallet(), there is now also tx.add_info_from_network()
  - callers of old tx.add_info_from_wallet() should now called either
    - tx.add_info_from_wallet(), then tx.add_info_from_network(), preferably in that order
    - tx.add_info_from_wallet() alone is sufficient if the tx is complete,
      or typically when not in a signing context
- callers of wallet.bump_fee and wallet.dscancel are now expected to have already
  called tx.add_info_from_network(), as it cannot be done in a non-async context
  (but for the common case of all-inputs-are-ismine, bump_fee/dscancel should work regardless)
- PartialTxInput.utxo was moved to the baseclass, TxInput.utxo
2023-03-12 00:21:57 +00:00
SomberNight
7746cc8e60 bip32: (trivial) rename method strpath_to_intpath, for symmetry
Required a much higher mental load to parse the name "convert_bip32_path_to_list_of_uint32"
than to parse "convert_bip32_strpath_to_intpath".
And we already have the ~inverse: "convert_bip32_intpath_to_strpath".
2023-03-10 14:23:17 +00:00
SomberNight
dce0615b5d test_wallet_vertical: add a failing test for rbf-batching 2023-03-08 12:43:29 +01:00
SomberNight
18cf546aab fix tests side-effecting each other in test_wallet_vertical.test_rbf 2023-03-07 19:07:44 +00:00
SomberNight
31f457c242 wallet.get_script_desc_for_addr: use xpub instead of derived pubkey
also put key origin info into descriptor, if available
2023-03-03 16:40:38 +00:00
SomberNight
847b4fa4c4 descriptor.py: sortedmulti to sort .pubkeys already in __init__ 2023-03-03 16:40:35 +00:00
SomberNight
9127c12fa3 descriptor.py: do more validation in PubkeyProvider, and add tests 2023-03-03 16:40:32 +00:00
SomberNight
e7849bce94 descriptor.py: clean-up and test PubkeyProvider.get_full_derivation_* 2023-03-03 16:40:28 +00:00
SomberNight
a536658eef descriptor.py: fix get_satisfaction_progress 2023-03-03 16:40:25 +00:00
SomberNight
144aac4523 descriptors: add more sanity checks, and unit tests 2023-03-03 16:40:22 +00:00
SomberNight
93b9591f25 tests: add test_descriptor.py from bitcoin-core/HWI 2023-03-03 16:40:19 +00:00
SomberNight
0647a2cf9f transaction.py: rm PartialTxInput.{num_sig, script_type} 2023-03-03 16:40:12 +00:00
SomberNight
f1f39f0e82 descriptors: wallet/transaction: construct intermediate osd 2023-03-01 17:53:52 +00:00
SomberNight
d2f75b7da5 descriptor.py: don't allow ypub/zpub inside descriptors 2023-03-01 17:53:45 +00:00
ThomasV
719b468eee Refresh bolt11 routing hints when channel liquidity changes:
- wallet_db update: separate Invoices and Requests.
 - do not store bolt11 invoice in Request
2023-02-28 15:33:17 +01:00
SomberNight
7aa1609718 tests: disable asyncio debug mode
see https://bugs.python.org/issue38608
2023-02-20 16:53:47 +00:00
SomberNight
d4338fb503 tests: clean-up use of asyncio 2023-02-20 16:53:44 +00:00
SomberNight
9ad2c9138d tests: rm SequentialTestCase to further simplify inheritance 2023-02-18 11:29:58 +00:00
SomberNight
c5bdd5007c tests: rework testnet
Inheritance was overkill here, and now we can use inheritance for new functionality X
without having to create classes for all combinations of {X, is_testnet}.
2023-02-18 11:29:54 +00:00
SomberNight
72e1be6f5e swaps: rm support for p2wsh-p2sh lockup scripts
- unused
- the client was already refusing to fund such lockup addresses (if the server asked)
- no existing unit tests for it, and as the choice is up to the server, it is hard to create tests
- no clear reason to want to use p2sh-nested scripts here, aside from curiosity
2023-02-17 14:10:03 +00:00
SomberNight
8a4c06b692 swaps: small refactor and add unit tests for claim tx 2023-02-17 14:04:03 +00:00
SomberNight
373db76ac9 util: kill bh2u
no longer useful, and the name is so confusing...
2023-02-17 11:43:11 +00:00
SomberNight
1ce37c8bb1 transaction: rm hardcoded sighash magic numbers 2023-02-17 11:40:12 +00:00
SomberNight
2378f92a6a tests: add more "sweep" tests for different script types 2023-02-14 12:19:18 +00:00
SomberNight
df2bd61de6 bip32: change hardened char "'"->"h" when encoding derivation paths
We accept either when decoding - this only changes what we use when encoding.
Single quotes are annoying to use in a shell, as they often need to be escaped.
2023-02-14 12:19:10 +00:00
ThomasV
8fa549c418 Merge pull request #8135 from spesmilo/scid_alias
Add support for option_scid_alias
2023-01-13 18:44:13 +01:00
ThomasV
7d52021d6b Merge pull request #8139 from SomberNight/202301_locale_decimal_point
locale amounts: consistently use "." as dec point, and " " as thou sep
2023-01-13 16:00:47 +01:00
ThomasV
b9393b0603 Support scid alias:
- save remote alias for use in invoices
 - derive local alias from wallet xpub
 - send channel_type without the option_scid_alias bit
   (apparently LND does not like it)
2023-01-13 15:47:30 +01:00
ThomasV
c109d5e722 lnwire: update csv files with recent BOLTs
Note: there are no more optional fields in msgdata, per f068dd0d8d
2023-01-13 12:50:48 +01:00
ThomasV
d95f3e5622 Use different trampoline bits than Eclair. Fixes #8141 2023-01-13 12:48:13 +01:00
SomberNight
762a9a9e7a follow-up prev: fix tests 2023-01-13 10:55:52 +00:00
SomberNight
7dcaa4b204 tests: add tests for wallet/invoices functionality
only for payment requests ("incoming invoices") for now
2023-01-12 18:19:08 +00:00
SomberNight
2a9909c252 locale amounts: consistently use "." as dec point, and " " as thou sep
Always use "." as decimal point, and " " as thousands separator.

Previously,
- for decimal point, we were using
  - "." in some places (e.g. AmountEdit, most fiat amounts), and
  - `locale.localeconv()['decimal_point']` in others.
- for thousands separator, we were using
  - "," in some places (most fiat amounts), and
  - " " in others (format_satoshis)

I think it is better to be consistent even if whatever we pick differs from the locale.
Using whitespace for thousands separator (vs comma) is probably less confusing for people
whose locale would user "." for ts and "," for dp (as in e.g. German).

The alternative option would be to always use the locale. Even if we decide to do that later,
this refactoring should be useful.

closes https://github.com/spesmilo/electrum/issues/2629
2023-01-10 14:45:35 +00:00
ThomasV
a383f56909 Simplify RBF user experience:
- replace complex strategies with a simpler choice,
   between preserving or decreasing the payment.
 - Always expose that choice to the user.
 - Show the resulting fees to the user before they click OK
2022-12-13 11:26:44 +01:00
ThomasV
49984b2ed4 fix tests (follow-up e1dc7d1e6f) 2022-12-11 07:24:28 +01:00
SomberNight
84faf7f99a tests: fix TestLNTransport probabilistic failure
lucky CI run: https://github.com/spesmilo/electrum/runs/9273471816
2022-11-03 15:45:15 +00:00
SomberNight
21c18bbbe7 util.parse_URI: honour docstring and only raise InvalidBitcoinURI
follow-up ac1d53f067
2022-11-03 12:47:21 +00:00
SomberNight
ac1d53f067 util.parse_URI: allow bip21 with lightning key without fallback addr
We would reject bip21 URIs that contained both an "address=" and a "lightning=" key with a bolt11 invoice,
where the bolt11 invoice did not contain a fallback address.
2022-10-31 19:03:12 +00:00
SomberNight
2863fb4ab4 tests: add "as_testnet" fn decorator, to run single tests in testnet
As opposed to using TestCaseForTestnet class, this allows having a single class
of many related unit tests, some using testnet and some using mainnet constants.
2022-10-31 18:44:38 +00:00
SomberNight
d3227d7489 transaction: for witness v0 txins, put both UTXO and WIT_UTXO in psbt
Until now we have been only putting PSBT_IN_NON_WITNESS_UTXO (="UTXO", full tx)
in segwit witness v0 txins, as signers wanted the full tx anyway due to
bip-143 sighash issue [0], and as WITNESS_UTXO can be calculated from UTXO.

My reading of bip-174 is that either behaviour is correct, but
achow101 said bip-174 expects PSBT_IN_WITNESS_UTXO for segwit inputs.
Regardless, including both fields does not increase the tx size too much
(UTXO can be very large ofc but we were already including that, WIT_UTXO is small).
This also might increase compatibility with some other software - I've found
some issues where this might have been the culprit [1][2][3].

closes https://github.com/spesmilo/electrum/issues/8039

related:
[0] https://github.com/spesmilo/electrum/pull/6198
[1] https://github.com/cryptoadvance/specter-desktop/issues/868
[2] https://github.com/cryptoadvance/specter-desktop/issues/1046
[3] https://github.com/cryptoadvance/specter-desktop/issues/1544
2022-10-31 17:14:21 +00:00
SomberNight
01b5e3f8e0 flake8: enable more mandatory tests 2022-10-31 16:13:22 +00:00
SomberNight
30ac889656 transaction: never put ypub/zpub in psbts, only plain xpubs
BIP-0174 specifies using standard bip32-compliant serialization for extended keys.
> The 78 byte serialized extended public key as defined by BIP 32.

closes https://github.com/spesmilo/electrum/issues/8036
2022-10-27 16:03:05 +00:00
SomberNight
45a939c146 tests: add test to check if we include xpubs in psbts
related: https://github.com/spesmilo/electrum/issues/8036
2022-10-27 15:55:01 +00:00
ThomasV
6e429ebf9a test_lnpeer: instead of sleeping for 0.2s, wait until peers are initialized
this should fix https://cirrus-ci.com/task/6585628493086720
2022-09-23 12:42:15 +02:00
ThomasV
fe6a83d6c1 fix test_fail_pending_htlcs_on_shutdown: poll number of htlcs 2022-09-22 18:26:02 +02:00