Commit Graph

224 Commits

Author SHA1 Message Date
SomberNight d8180c678b Qt addresses list: show derivation path in tooltip (also addr dialog)
related: #5641
2020-03-01 05:45:15 +01:00
SomberNight 1ca6f6f306 Qt address list speedup: wallet.is_beyond_limit was slow 2020-02-29 07:28:13 +01:00
SomberNight 88658f9c2c WalletDB: add type hints, and also corresponding asserts for sanity 2020-02-24 18:26:49 +01:00
ThomasV 570167a2c4 restrict lightning to p2wpkh wallets 2020-02-20 21:17:25 +01:00
ThomasV 21fffeb7ad do not store 'outputs' field in requests (it is unused) 2020-02-19 11:24:44 +01:00
SomberNight 0723355a0f util.Satoshis: note that sometimes this actually has 'msat' precision 2020-02-17 16:52:25 +01:00
SomberNight a6302b3a12 fix wallet history order: incl both on-chain and LN, sorted by time
GUIs now respect order of wallet.get_full_history(), which is probably the sane
thing to do, given that is the order the "balance" column is calculated in.

fixes #5958
2020-02-17 16:33:54 +01:00
ThomasV 0869e09275 Qt: fix balance column 2020-02-17 14:55:10 +01:00
ThomasV 4dc74870e1 Catch exceptions raised in LNWorker._pay_to_route
Reset payment status if an exception is caught.
Also, do not pass status to the 'invoice_status' network callback.
This fixes #5869, #5870, #5964.
2020-02-17 12:33:43 +01:00
ThomasV e3ccfe6449 kivy: make backups optional 2020-02-15 17:26:03 +01:00
ThomasV d9172ade71 kivy: use password + pin_code
- password is per wallet, is retained in memory
 - pin code is saved in config
2020-02-15 17:09:09 +01:00
ThomasV d5dc8d1ab2 kivy: save pin code in memory 2020-02-15 16:28:15 +01:00
ThomasV 2dad87cbb4 Automate backups:
- backup wallet file on each channel creation
 - on android, a backup password is entered in settings
 - on desktop, the backup path is in settings
2020-02-15 16:28:15 +01:00
ThomasV cee8607218 save_backup: use db.dump() to clone the db 2020-02-15 16:28:15 +01:00
ThomasV 87b7d2c0c0 wallet backup function for kivy/android 2020-02-15 16:28:15 +01:00
ThomasV 62eceeb573 Save and read lighting backups (Qt) 2020-02-15 16:28:15 +01:00
ThomasV 2a7b5081c9 channel states: make sure that closing_txid is saved if channel is closed 2020-02-14 13:25:04 +01:00
SomberNight ab4e2dd9f0 wallet: fix is_mine/can_sign. don't just rely on ks, also check script
Previously a standard (single-sig) wallet would consider a multisig txin as is_mine
(if the keystore found its pubkey in the txin).

fixes #5948
2020-02-12 18:14:07 +01:00
SomberNight 0d33da2f95 wallet: (sanity) is_mine now guaranteed to handle 'None' input 2020-02-12 18:14:04 +01:00
SomberNight 0a5ad9fda4 ecc: small API clean-up 2020-02-11 16:42:02 +01:00
ThomasV e1ce3aace7 Separate db from storage
- storage is content-agnostic
 - db and storage are passed to wallet contructor
2020-02-10 17:45:23 +01:00
ThomasV dbceed2647 Restructure wallet storage:
- Perform json deserializations in wallet_db
 - use StoredDict class that keeps tracks of its modifications
2020-02-04 13:35:58 +01:00
SomberNight a041a0c075 wallet: log when saving already paid invoice
(maybe it should not be allowed?)
2020-01-21 16:50:45 +01:00
SomberNight 6d270364c6 qt paytoedit: properly handle multiple max ('!') outputs 2020-01-18 04:15:44 +01:00
SomberNight 94888739d3 try to fix "--offline" mode 2020-01-09 19:23:24 +01:00
SomberNight 9b28f6df7b wallet: encrypt storage by default
notably, now also in kivy
2019-12-19 14:22:47 +01:00
SomberNight 79681c90e0 wallet._is_onchain_invoice_paid: support "zero amount" invoice 2019-12-17 22:12:51 +01:00
SomberNight 02baae10d7 kivy: implement opening storage-encrypted wallet files 2019-12-17 18:39:52 +01:00
SomberNight 7b49832a3f payment requests: fix explicit "None" expiration
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 994, in <lambda>
    self.create_invoice_button.clicked.connect(lambda: self.create_invoice(False))
  File "...\electrum\electrum\gui\qt\main_window.py", line 1123, in create_invoice
    key = self.create_bitcoin_request(amount, message, expiry)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1132, in create_bitcoin_request
    addr = self.wallet.get_unused_address()
  File "...\electrum\electrum\wallet.py", line 1452, in wrapper
    addr = func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet.py", line 1465, in get_unused_address
    addrs = self.get_unused_addresses()
  File "...\electrum\electrum\wallet.py", line 1459, in get_unused_addresses
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1459, in <listcomp>
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1535, in get_request_status
    if exp > 0 and time.time() > timestamp + exp:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
2019-12-16 21:03:34 +01:00
ThomasV 2c6a1f55fb Merge pull request #5825 from SomberNight/201912_local_tx_can_be_partial
wallet: allow saving partial tx as local (if it has a txid)
2019-12-15 16:40:46 +01:00
SomberNight fcd9752f19 keystore: change derive_pubkey API to return bytes 2019-12-10 20:41:47 +01:00
SomberNight ea62027599 wallet: faster decrypt_message for Imported_Wallet 2019-12-10 20:08:41 +01:00
SomberNight 869a728317 wallet: use abstract base classes 2019-12-10 19:34:44 +01:00
ThomasV f08796fe68 Allow requests that never expire 2019-12-10 14:45:29 +01:00
SomberNight 0ab88b821c keystore: use abstract base classes, introduce MPKMixin 2019-12-10 00:31:01 +01:00
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