Commit graph

189 commits

Author SHA1 Message Date
SomberNight
30dcab0877
wallet: allow saving partial txns as local (but require txid) 2019-12-08 04:32:44 +01:00
SomberNight
8e89c0c971
wallet: some clean-up re get_address_history vs db.get_addr_history
note: tests needed changing due to behavioural change in wallet.get_receiving_address()
Previously wallet.get_receiving_address used wallet.db.get_addr_history,
now it (indirectly) uses wallet.get_address_history, which now also considers local txns.
2019-12-07 05:42:28 +01:00
SomberNight
61aebd0f2d
(fix) qt coin selection: signatures for coins would persist in memory
Scenario: select some UTXOs in the 'Coins' tab. Create a tx and sign it.
Close the tx dialog without broadcasting/etc (cancel tx).
Signatures would remain for selected UTXOs.
Create new tx -> invalid sigs.
2019-12-06 19:45:55 +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
SomberNight
cfbd83c432
wallet: minor clean-up 2019-11-29 13:12:23 +01:00
SomberNight
6b195437ed
wallet: "future" txns num conf is now negative
flipped the sign so that TxMinedInfo.conf can be consistently used in inequalities
2019-11-21 05:01:59 +01:00
SomberNight
49284f716b
wallet: bump fee now supports coin selection
related: #5719
2019-11-20 18:43:05 +01:00
SomberNight
8bd27851a4
qt tx dialog: only allow "save as local" for complete txns 2019-11-19 18:41:44 +01:00
ThomasV
78813dcb7d Pass make_tx function to ConfirmTxDialog
- allow 'spend max' when opening a channel (fixes #5698)
 - display amount minus fee when 'max' buttons are pressed
 - estimate fee of channel funding using a template with dummy address
2019-11-14 10:20:19 +01:00
SomberNight
fef1ddd416
wallet: fix #5748 2019-11-08 13:43:12 +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
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