1
0
Commit Graph

376 Commits

Author SHA1 Message Date
SomberNight
0866581b2c daemon error-handling: fix traceback.format_exception() on old python
The new API for traceback.format_exception was only added in python 3.10 (91e93794d5).
2024-06-05 14:45:28 +00:00
Sander van Grieken
9674ffc8ee bip21: add testcases for amount bounds 2024-05-29 10:22:28 +02:00
SomberNight
07c80d2ca1 ecc: ecdsa_verify to enforce low-S rule
The low-S rule for ecdsa signatures is mandated by Bitcoin Core policy/standardness (though not by consensus). If we get signatures from untrusted sources, we should mandate they obey the policy rules. (e.g. from LN peers)

Note that we normalize the signatures in the sig format conversion methods (DER <-> (r,s) <-> sig64).

The BOLTs treat high-S signatures as invalid, and this changes our behaviour to that.
(previously we would silently normalize the S value)

see https://github.com/bitcoin/bitcoin/pull/6769
see https://github.com/lightning/bolts/pull/807
2024-05-27 17:12:33 +00:00
SomberNight
d61c6037ea ecc: add test that verify_usermessage does not enforce low-S rule 2024-05-27 17:09:45 +00:00
SomberNight
bafd52ec6d lnsweep: rm one usage of Transaction.get_preimage_script()
get_preimage_script should really have been private API...
looks like everywhere it is used outside of transaction.py, it is actually abused :/
Other existing usages in plugin code I don't dare to touch without lots of manual testing...
2024-05-24 13:40:48 +00:00
Ondřej Vejpustek
70f0ed992f slip39: implement extendable backups 2024-05-20 16:57:11 +02:00
SomberNight
67d373357b lnworker: make PaymentFeeBudget defaults configurable
- make PaymentFeeBudget proportional fee and flat cutoff fee configurable
  - closes https://github.com/spesmilo/electrum/issues/7622
- increase flat cutoff fee default to 10 sat
  - closes https://github.com/spesmilo/electrum/issues/7669
- rm RouteEdge.is_sane_to_use() (per edge limit) and just rely on budgets (per route limit)
2024-05-08 15:53:22 +00:00
SomberNight
13d9677e53 transaction: tx.sign API change: rm hex usage 2024-04-29 17:10:30 +00:00
SomberNight
2f1095510c bitcoin.py/transaction.py: API changes: rm most hex usage
Instead of some functions operating with hex strings,
and others using bytes, this consolidates most things to use bytes.

This mainly focuses on bitcoin.py and transaction.py,
and then adapts the API usages in other files.

Notably,
- scripts,
- pubkeys,
- signatures
should be bytes in almost all places now.
2024-04-29 17:10:26 +00:00
SomberNight
cf2ed509b4 dependencies: remove bitstring
- `bitstring` started depending on `bitarray` in version 4.1 [0]
  - that would mean one additional dependency for us (from yet another maintainer), which is not even pure python
- we only use bitstring for bolt11-parsing
- hence this PR rewrites the bolt11-parsing and removes `bitstring` as dependency
- note: I benchmarked lndecode using [1], and the new code performs better,
  taking around 80% time needed for old code (when using bitstring 3.1.9, pure python).
  Though the variance is quite large in both cases.

[0]: 95ee533ee4/release_notes.txt (L108)
[1]: d7597d96d0
2024-04-24 14:14:31 +00:00
ThomasV
9a7195d5ab test_lnpeer: fix node_id in storage of created peers 2024-04-18 10:34:48 +02:00
momantech
2b6090429c Fix some comments
Signed-off-by: momantech <cuimoman@qq.com>
2024-04-17 18:46:05 +08:00
ThomasV
8759928ec0 Merge pull request #9000 from SomberNight/202404_ecc_schnorr
ecc: add bindings for schnorr sign/verify, and refactor
2024-04-15 11:57:29 +02:00
ThomasV
3e7d4749cf turn classmethod 'find_all_plugins' into an instance method.
change 'use_' prefix to 'enable_plugin_'
2024-04-13 11:35:49 +02:00
SomberNight
52f1a2ce25 ecc: add method "bip340_tagged_hash"
I decided to use the stdlib (hashlib) instead of libsecp for this,
as it is simple enough, and the former is faster on my PC.

Added a unit test that compares the two.
2024-04-12 14:20:45 +00:00
SomberNight
bd9d0ccc33 ecc: refactor/clean-up sign/verify APIs 2024-04-11 15:25:45 +00:00
SomberNight
44e27ac8b5 ecc: add bindings for schnorr sign/verify
and require "schnorrsig" and "extrakeys" modules of libsecp256k1
2024-04-11 13:09:57 +00:00
SomberNight
30c9f5b6b1 walletdb: chan dict: small clean-up (incl db upgrade)
- "fail_htlc_reasons" was removed in 9b1c40e396
- "unfulfilled_htlcs": rm 2 dead items from the 4-tuple,
   and convert False value of forwarding_key
2024-03-01 16:28:46 +00:00
ThomasV
94a8754bdd regtest: test swapserver with trampoline onions 2024-03-01 12:00:24 +01:00
SomberNight
51b7fc04ef walletdb: fix convert_version_58 for partial local txs
The transaction dict can also contain PSBTs (in addition to complete raw hex txs).
This is the case if the user has saved a partial (e.g. unsigned) tx as local into the history.

fixes https://github.com/spesmilo/electrum/issues/8913
2024-02-26 18:54:21 +00:00
SomberNight
d01582d58c fix tests (follow-up)
follow-up 197979063a
2024-02-22 12:26:25 +00:00
ThomasV
32775c1b5d regtest: fix varname in wait_until_htlcs_settled
(this was not affecting the tests)
2024-02-22 09:40:59 +01:00
SomberNight
8ab3dcce5d keystore: API changes for from_seed/from_bip43_rootseed/bip39_to_seed
- force kwargs
- add type hints
2024-02-21 15:08:19 +00:00
Sander van Grieken
6ecbb8eb3f tests: add test for payment_identifier.invoice_from_payment_identifier() 2024-02-19 11:54:32 +01:00
Sander van Grieken
0faf6928c0 tests: explicit sync on self.app instance ready and make sure _testcase_event is cleared before
QMetaObject.invokeMethod as that can race if it gets inadvertently executed synchronously.
2024-02-16 16:56:14 +01:00
Sander van Grieken
73fee69f5c tests: move /electrum/tests to /tests 2024-02-16 15:40:45 +01:00