Commit graph

190 commits

Author SHA1 Message Date
SomberNight
20bbe85bce
receive requests: encode lightning invoices as uppercase -> smaller QRs
By encoding bolt11 invoices as uppercase text in QR codes,
we can use the alphanumeric mode, which results in non-negligibly smaller QR codes.
2019-12-07 05:58:58 +01:00
ThomasV
7a080352f8
Merge pull request #5809 from SomberNight/201911_invoice_paid_detection
wallet: better (outgoing) invoice "paid" detection
2019-11-29 18:24:08 +01:00
SomberNight
8dbbc21aff
wallet: better (outgoing) invoice "paid" detection
- no more passing around "invoice" in GUIs, invoice "paid" detection is now handled by wallet logic
- a tx can now pay for multiple invoices
- an invoice can now be paid by multiple txs (through partial payments)
- new data structure in storage: prevouts_by_scripthash
  - type: scripthash -> set of (outpoint, value)
  - also, storage upgrade to build this for existing wallets
2019-11-29 15:06:16 +01:00
roth
2ce8dd460b Color-Code Addresses in Kivy UI (#5774)
* Added static coloring of the TX output dialog.

Coloring was suggested in #5750
2019-11-28 20:40:28 +00:00
SomberNight
ddeb176b3d
kivy: fix open_channel (API was changed) 2019-11-23 20:50:30 +01:00
SomberNight
557987d4eb
add/fix some open_channel related type hints 2019-11-23 20:28:46 +01:00
ThomasV
fd8236538a Open lightning channels with partially signed tx.
Fixes #5379.
2019-11-23 19:49:12 +01:00
ThomasV
61dfcba092 Refactor channel states:
- persisted states are saved
 - state transitions are checked
 - transient states are stored in channel.peer_state
 - new channel states: 'PREOPENING', 'FUNDED' and 'REDEEMED'
 - upgrade storage to version 21
2019-11-22 20:14:54 +01:00
SomberNight
03cc63205f
trivial: use logger.exception instead of traceback.print_exc 2019-11-21 17:55:00 +01:00
SomberNight
4057140e6a
lightning qr codes: more robust parsing
kivy qr code handling did not accept "lightning:" prefix or uppercase
2019-11-20 03:21:59 +01:00
SomberNight
27df235c26
transactions: reading QR codes: clean-up and accept all encodings 2019-11-07 06:33:15 +01:00
SomberNight
aa518c0ea5
psbt: allow insecure signing of legacy UTXOs without full previous tx
When "importing" a psbt, we accept witness utxos even for legacy inputs
(warning shown to user in gui).
When "exporting" a psbt, we follow the spec; except when exporting as a QR code,
in which case we include witness utxos for all inputs.
This makes QR codes for psbts with legacy inputs feasible, just like they
were before, with our custom tx serialization format (with the same risk,
of burning coins as miner fees).
2019-11-07 02:40:10 +01:00
SomberNight
74a46689d8
kivy tx dialog: was missing tx.add_input_from_wallet() call
resulted in e.g. incorrect "tx unrelated to wallet" detection for beyond-gap-limit stuff
2019-11-07 02:26:58 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
ThomasV
427f7f8eeb fix #5731 2019-10-29 08:06:53 +01:00
SomberNight
a20317fe2a
fix #5726 2019-10-28 21:17:20 +01:00
ThomasV
7b5869c7bc kivy:
- simplify menu
 - add lightning network dialog
2019-10-25 16:46:52 +02:00
ThomasV
24221584e2 fix clear_requests button 2019-10-24 09:32:40 +02:00
ThomasV
a0ec2690cf Call wallet.set_paid after onchain broadcast. Check if invoices are expired in util.get_request_status 2019-10-23 17:33:46 +02:00
ThomasV
e35bddcc09 kivy: fix can_pay in invoice_dialog 2019-10-23 08:33:16 +02:00
ThomasV
aac0fe9ae6 kivy: show status with color. show inflight attempts. 2019-10-22 15:41:45 +02:00
ThomasV
cd86bec894 kivy: add 'delete channel' button 2019-10-22 12:27:55 +02:00
ThomasV
576fbbd074 kivy: minor fixes 2019-10-22 11:59:16 +02:00
ThomasV
3af7920b63 fix typo 2019-10-14 12:02:04 +02:00
ThomasV
1b0521cabd kivy: toggle lightning dialog 2019-10-14 11:59:04 +02:00
ThomasV
90ce9f195b Allow user to enable lightning in the GUI. Make it a per-wallet setting. 2019-10-13 20:34:38 +02:00
ThomasV
dd0be1541e Improve handling of lightning payment status:
- Move 'handle_error_code_from_failed_htlc' to channel_db,
and call it from pay_to_route, because it should not be
called when HTLCs are forwarded.
- Replace 'payment_received' and 'payment_status'
callbacks with 'invoice_status' and 'request_status'.
- Show payment error logs in the Qt GUI
- In the invoices list, show paid invoices for which
we still have the log.
2019-10-11 17:51:33 +02:00
SomberNight
04edad9984
config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
2019-09-22 20:46:01 +02:00
ThomasV
f08e5541ae Refactor invoices in lnworker.
- use InvoiceInfo (NamedTuple) for normal operations,
   because lndecode operations can be very slow.
 - all invoices/requests are stored in wallet
 - invoice expiration detection is performed in wallet
 - CLI commands: list_invoices, add_request, add_lightning_request
 - revert 0062c6d695 because it forbids self-payments
2019-09-22 16:06:53 +02:00
SomberNight
49a2dbb021
kivy: receive to ln invoice should be disabled if lightning is disabled 2019-09-16 16:19:19 +02:00
SomberNight
ff9cc4d292
kivy: fix "use change addresses" setting (previously ignored, always on)
this config setting is stored in the WalletStorage unlike most others

closes #5643
2019-09-16 16:01:52 +02: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
79de0489e3 kivy: do not remove fee from tx value in history (minor) 2019-09-12 12:32:38 +02:00
ThomasV
65b88dca86 return fees in history, show them in kivy GUI 2019-09-11 17:49:40 +02:00
ThomasV
30092cd68c kivy: request PIN to load_wallet only on android 2019-09-11 16:36:04 +02:00
SomberNight
c531c72940
kivy: attempt at handling (some) exceptions on startup 2019-09-10 21:29:13 +02:00
SomberNight
a05dab2c4d
storage: read/write sanity checks
related: #4110
supersedes: #4528
2019-09-10 21:17:15 +02:00
SomberNight
1a08063928
config: remove 'open_last_wallet' side-effecting
related: #5629
2019-09-10 17:10:52 +02:00
ThomasV
cefa4762ba do not create multiple instances of SimpleConfig (fix #5629). Add config field to wallet 2019-09-10 08:57:40 +02:00
SomberNight
e3d5475f03
kivy: commit png icons (for svg resources) into repo 2019-09-08 17:05:06 +02:00
SomberNight
b1dc281cba
kivy amount_dialog: truncate btc amounts to max precision
closes #5624
2019-09-08 15:41:10 +02:00
SomberNight
0deb12cb2b
kivy: fix ln channel open via scan_qr 2019-09-05 17:06:42 +02:00
ThomasV
128285a050 http server: add ssl and bip70 signed requests 2019-09-05 10:57:50 +02:00
SomberNight
74366f5cce
android build: persist gradle datadir
avoids re-downloading hundreds of MB of data on every run
2019-09-02 17:32:48 +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
8404e07061
only build one android apk on Travis
follow-up 0333632eb0
2019-09-01 20:05:40 +02:00
SomberNight
54d468f457
android apk: build two apks. ARMv7 and ARMv8 2019-09-01 15:38:26 +02:00
SomberNight
75afd06ca3
android build: don't download Apache ANT on every build 2019-08-31 19:08:41 +02:00
SomberNight
98c8c2127c
android build: update kivy, p4a, buildozer
- also merge https://github.com/kivy/buildozer/pull/957 as prereq for
building multiple apks (one per arch)
- and custom buildozer commit to put target arch into apk name
2019-08-31 17:06:02 +02:00