1
0
Commit Graph

49 Commits

Author SHA1 Message Date
f321x
61492d361e Use async dnspython methods for openalias/dnssec 2025-05-16 17:09:41 +02:00
Sander van Grieken
9be6d6e732 small fixes, imports, whitespace 2025-03-25 16:50:37 +01:00
ThomasV
3721f04ac8 replace electrum/ecc with electrum_ecc package 2024-10-10 15:46:00 +00:00
ThomasV
2f3d89f415 prepare for separation of ecc module:
- move encrypt/sign functions elsewhere
- remove local dependencies in ecc.py, ecc_fast.py (except logging)
2024-06-17 13:05:57 +02: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
bd9d0ccc33 ecc: refactor/clean-up sign/verify APIs 2024-04-11 15:25:45 +00:00
SomberNight
612a8e6424 qt: fix: bip70 pay reqs need x509 verification
regression from https://github.com/spesmilo/electrum/pull/8462

- pr.verify() was called in qml, but not in qt gui
- we now call pr.verify() in get_payment_request(), to make the API less error-prone
- it is now ok to call pr.verify() multiple times, the result is cached
2023-07-10 17:50:53 +00:00
SomberNight
24980feab7 config: introduce ConfigVars
A new config API is introduced, and ~all of the codebase is adapted to it.
The old API is kept but mainly only for dynamic usage where its extra flexibility is needed.

Using examples, the old config API looked this:
```
>>> config.get("request_expiry", 86400)
604800
>>> config.set_key("request_expiry", 86400)
>>>
```

The new config API instead:
```
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS
604800
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS = 86400
>>>
```

The old API operated on arbitrary string keys, the new one uses
a static ~enum-like list of variables.

With the new API:
- there is a single centralised list of config variables, as opposed to
  these being scattered all over
- no more duplication of default values (in the getters)
- there is now some (minimal for now) type-validation/conversion for
  the config values

closes https://github.com/spesmilo/electrum/pull/5640
closes https://github.com/spesmilo/electrum/pull/5649

Note: there is yet a third API added here, for certain niche/abstract use-cases,
where we need a reference to the config variable itself.
It should only be used when needed:
```
>>> var = config.cv.WALLET_PAYREQ_EXPIRY_SECONDS
>>> var
<ConfigVarWithConfig key='request_expiry'>
>>> var.get()
604800
>>> var.set(3600)
>>> var.get_default_value()
86400
>>> var.is_set()
True
>>> var.is_modifiable()
True
```
2023-05-25 17:39:48 +00:00
SomberNight
312f2641e7 don't use bare except
use "except Exception", or if really needed explicitly "except BaseException"
2023-04-24 12:58:01 +00:00
SomberNight
72da9c1a6a sanitise untrusted error bytes before logging it
full-blown paranoia kicking in
2023-04-06 14:28:31 +00:00
SomberNight
02a2f02d02 qml: actually do the x509 validation for bip70
as in other GUIs
2023-03-14 17:04:39 +00:00
SomberNight
373db76ac9 util: kill bh2u
no longer useful, and the name is so confusing...
2023-02-17 11:43:11 +00:00
yanmaani
04b81d6b82 contrib: add generate_payreqpb2.sh script 2022-07-04 12:00:00 +00:00
SomberNight
d04e3c7288 bip70 paymentrequest: remove support for "file" URIs 2022-05-26 19:50:47 +02:00
SomberNight
7e77a7e1cc email plugin: (trivial) adapt to Invoices refactor 2022-05-23 18:53:19 +02:00
SomberNight
cfa6b91f22 wallet_db: rm dependence on PaymentRequest class in convert_version_25
Change convert_version_25 to delete invoices instead of converting them.
convert_version_25 was released ~2 years ago. Wallet files not opened since will have old bip70 invoices deleted upon upgrading.

In general it is ~unsafe for convert_version_* to depend on other modules of the code.
(using e.g. sha256 is fine as its API will never change,
but using e.g. PaymentRequest is dangerous as its API might change over time)
2022-04-23 20:15:10 +02:00
SomberNight
adfe542fae wallet_db upgrade: recalc keys of outgoing on-chain invoices
closes https://github.com/spesmilo/electrum/issues/7777
2022-04-22 19:53:55 +02:00
ThomasV
e392197ab9 wallet_db upgrade:
- unify lightning and onchain invoices, with optional fields for bip70 and lightning
 - add receive_address fields to submarine swaps
2022-04-20 12:48:22 +02:00
zebra-lucky
c43729b076 make_unsigned_request: set network for testnet 2021-02-08 20:26:16 +02:00
zebra-lucky
d53d4e46e6 paymentrequest: check network on PaymentRequest parse 2021-02-04 07:32:37 +02:00
SomberNight
d5f368c584 LN invoices: support msat precision
fixes #6250
2020-06-22 22:48:13 +02:00
SomberNight
0b224ba685 invoices: minor clean-up (type hints, mark broken things)
also rm some dead code
2020-06-13 18:54:22 +02:00
ThomasV
56f4932f10 import/exports to json files:
- fix #5737
 - add import/export or requests
2020-06-05 13:17:01 +02:00
ThomasV
cfdfbd2bfe follow-up 6058829870 2020-06-02 16:32:07 +02:00
ThomasV
6058829870 Use attr.s classes for invoices and requests:
- storage upgrade
 - fixes #6192
 - add can_pay_invoice, can_receive_invoice to lnworker
2020-06-01 21:02:45 +02:00
SomberNight
7e3d50a641 README: rm "Compile the protobuf description file" section
The generated file "paymentrequest_pb2.py" is already committed into the repository,
so users don't need to run this command.
Further, the command itself is preserved in "paymentrequest.py"
(it gets printed if we cannot find the generated file).
2020-02-21 18:50:52 +01:00
SomberNight
bafe8a2fff integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
c7346c1eb8 kivy: fix paying onchain invoices
when pasting a new invoice and paying it
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/kivy/uix/screens.py", line 358, in _do_send_onchain
    tx = self.app.wallet.make_unsigned_transaction(coins, outputs, None)
  File "/home/user/wspace/electrum/electrum/wallet.py", line 849, in make_unsigned_transaction
    if o.type == TYPE_ADDRESS:
AttributeError: 'tuple' object has no attribute 'type'

when loading back a saved invoice
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/kivy/uix/screens.py", line 358, in _do_send_onchain
    tx = self.app.wallet.make_unsigned_transaction(coins, outputs, None)
  File "/home/user/wspace/electrum/electrum/wallet.py", line 849, in make_unsigned_transaction
    if o.type == TYPE_ADDRESS:
AttributeError: 'list' object has no attribute 'type'
2019-09-13 15:00:34 +02:00
ThomasV
aaed594772 Simplify invoices and requests.
- We need only two types: PR_TYPE_ONCHAIN and PR_TYPE_LN
 - BIP70 is no longer a type, but an optional field in the dict
 - Invoices in the wallet are indexed by a hash of their serialized list of outputs.
 - Requests are still indexed by address, because we never generate Paytomany requests.
 - Add 'clear_invoices' command to CLI
 - Add 'save invoice' button to Qt
2019-09-12 20:11:20 +02:00
ThomasV
94e7e94e2f fix ssl config names, add new config tab 2019-09-05 11:36:50 +02:00
ThomasV
128285a050 http server: add ssl and bip70 signed requests 2019-09-05 10:57:50 +02:00
ThomasV
a50f935aec Restructure invoices and requests (WIP)
- Terminology: use 'invoices' for outgoing payments, 'requests' for incoming payments
 - At the GUI level, try to handle invoices in a generic way.
 - Display ongoing payments in send tab.
2019-09-02 15:35:44 +02:00
SomberNight
db8e6cabb4 bip70 payreq: catch TimeoutError to avoid hanging "please wait" dialog
related #5337
2019-08-27 18:03:01 +02:00
ThomasV
7bb4ea150f gui: show incoming lightning requests, add on-chain icon 2019-08-20 09:03:11 +02:00
ThomasV
b0d6000771 turn lightning_payments_completed into dict. Show status of lightning payments in GUI. Make 'listchannels' available offline 2019-08-20 09:03:11 +02:00
SomberNight
33308307a4 bip70 payreq: do not show error messages in gui
closes #5393
2019-06-05 19:40:33 +02:00
SomberNight
0553ab7f3f follow-up prev
PaymentRequest.error is really not intuitive.........
2019-06-05 19:05:58 +02:00
SomberNight
d2de8de356 qt payment requests: fix some races
closes #5283, #5407, #5121
2019-06-05 16:29:33 +02:00
SomberNight
3385a94753 logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
beacf88420 qt invoice list: fix #5222 2019-03-26 16:38:32 +01:00
SomberNight
78f5afff74 use certifi directly instead of requests 2018-12-13 23:11:59 +01:00
SomberNight
36f64d1ad9 bitcoin/ecc: some more type annotations 2018-11-18 22:07:27 +01:00
SomberNight
e059867314 paymentrequest: be explicit about only allowing "addresses" 2018-11-14 16:04:43 +01:00
SomberNight
1686a97ece bip70 PRs: use aiohttp instead of requests. use proxy. small fixes. 2018-11-05 19:31:17 +01:00
SomberNight
a88a2dea82 split bip32 from bitcoin.py 2018-10-25 22:20:33 +02:00
SomberNight
e5e3ac0364 fix #4720 2018-09-17 14:44:01 +02:00
SomberNight
f3f5b8a5d6 fix #4312 2018-08-15 13:43:19 +02:00
SomberNight
2eb72d496f transaction: introduce TxOutput namedtuple 2018-08-01 19:10:08 +02:00
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00