Commit graph

178 commits

Author SHA1 Message Date
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
8a7c3447b3
tx dialog: try harder to show fee 2019-11-07 02:24:16 +01:00
SomberNight
6573e7f1f3
test_wallet_vertical: add test for manual coinjoin 2019-11-06 18:40:16 +01:00
SomberNight
8e09d429c0
psbt: "updater" must swap NON_WITNESS_UTXO for WITNESS_UTXO if txin is segwit 2019-11-06 03:46:00 +01:00
SomberNight
90b190bbcd
psbt: fix bug re witness_utxo serialization 2019-11-04 22:25:09 +01:00
SomberNight
d872be7f6b
psbt: don't put xpubs and full paths into tx by def; only while signing 2019-11-04 22:25:02 +01:00
SomberNight
e6c841d05f
psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing 2019-11-04 22:24:59 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01: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
9fbac40d56 filter out None in wallet.get_invoices 2019-10-23 05:30:16 +02:00
SomberNight
d9b5ab3086
wallet: fix bump_fee when there are only change outputs
closes #5718
closes #5603
2019-10-22 17:12:23 +02:00
ThomasV
a13cea6f8a add remove_lightning command 2019-10-14 11:18:57 +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
ThomasV
638de63f13 lnworker: rename 'invoices' to 'payments' when they can be in both directions 2019-10-09 20:16:11 +02:00
ThomasV
b08cfac643 fix #5681 2019-10-07 17:24:49 +02:00
SomberNight
a51a2a7f8f
wallet: minor invoices fix
handle "lightning disabled & there are LN invoices in wallet" case
2019-10-07 05:29:34 +02:00
ThomasV
1773bd6cd6
Merge pull request #5658 from vesellov/master
bug fix in  electrum/wallet.py
2019-09-26 13:11:34 +02:00
Veselin Penev
4f82bf9269 bug fix in electrum/wallet.py 2019-09-25 18:56:17 +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
d6c7dee547 follow-up previous commit 2019-09-22 17:32:22 +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
6a32187f01
qt: fix address dialog
(was showing full history, not just for addr)
2019-09-21 18:48:44 +02:00
SomberNight
a1d7d39f68
commands: add type hints for "wallet" param, and fix code rot found via 2019-09-21 02:14:22 +02:00
SomberNight
0b87ce426f
minor qt send tab fixes. notably 'send max' was broken
follow-up aaed594772
2019-09-16 02:54:32 +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
3d04399581 follow-up 7b828359c6 2019-09-12 13:12:48 +02:00
ThomasV
7b828359c6 simplify get_tx_fee 2019-09-12 12:26:49 +02:00
SomberNight
482605edbb wallet: organise get_tx_fee. store calculated fees. storage version 19. 2019-09-12 08:59:27 +02:00
ThomasV
5c83e8bd1c follow-up 241873f0a4 2019-09-12 08:58:58 +02:00
SomberNight
b138fff9a5
wallet: txi/txo small clean-up 2019-09-12 04:07:17 +02:00
SomberNight
241873f0a4
address_synchronizer.get_history now returns HistoryItem(NamedTuple)s 2019-09-12 04:06:51 +02:00
ThomasV
65b88dca86 return fees in history, show them in kivy GUI 2019-09-11 17:49:40 +02:00
SomberNight
9c31c1f970
wallet: address_is_old is now checked using SPV (during sync) 2019-09-10 18:26:09 +02:00
SomberNight
b2920db8b8
config: enforce that SimpleConfig is singleton
related: #5629
2019-09-10 18:01:10 +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
d1dea9343e
wallet: address_is_old minor clean-up
also, synchronize was defined twice in AddressSynchronizer
2019-09-09 01:34:29 +02:00
ThomasV
e5ff4fc7cd fix #5605 2019-09-06 13:43:00 +02:00
ThomasV
28da62f51b add PayServer settings to settings_dialog 2019-09-05 14:43:27 +02:00
ThomasV
466c2bd293 for now, use PR_PAID for onchain unconfirmed 2019-09-05 11:33:09 +02:00
ThomasV
128285a050 http server: add ssl and bip70 signed requests 2019-09-05 10:57:50 +02:00
SomberNight
1bd9b3a66a
commands: fix "restore" cmd
Previously commands did not run on the asyncio thread but now they do.
"restore" was polling like "while 1: time.sleep()", blocking the event loop.

Now "restore" does not sync the wallet; which is actually cleaner
as previously this wallet would never get unloaded from the daemon (syncing forever).

This is also symmetric with the "create" cmd which also does not try to sync with the network.

However now it became difficult to write a script that restores a wallet and wants to wait
until it gets synced. Workaround for now is to poll with "list_wallets" whether it's synced.

We could create a new command that blocks until the loaded wallet gets synced.
2019-09-04 20:15:54 +02:00
SomberNight
a42a773d19
storage: replace STO_EV_* ints with IntEnum 2019-09-04 13:31:49 +02:00
ThomasV
747ab7a0a2 Integrate http_server (previously in electrum-merchant)
Use submodule to fetch HTML and CSS files
2019-09-04 12:20:05 +02:00
SomberNight
ff94240139
qt receive tab: fix on-chain pay.requests without amount 2019-09-03 18:33:49 +02:00
SomberNight
073a09f926
wallet/keystore: small inheritance clean-up 2019-09-03 16:24:05 +02:00
SomberNight
ab76a1fe5b
wallet.add_hw_info: also store "is_change" in output_info
as it seems every consumer wants to know this and has its own hacks to
figure it out
2019-09-03 14:34:10 +02:00
SomberNight
ac329797e0
wallet.add_hw_info: minor clean-up 2019-09-03 14:20:00 +02:00
ThomasV
d5691129bb
Merge pull request #5604 from MrNaif2018/master
Fix for onchain_history summary building
2019-09-02 18:35:23 +02:00