1
0
Commit Graph

13341 Commits

Author SHA1 Message Date
SomberNight
d75f9c6e80 kivy: receive request: fix RefLabel for "Address" so it can be exported
It is 'data' rather than 'text' that should be set for a RefLabel.

fixes #7042
2021-02-19 02:29:00 +01:00
SomberNight
1ee99cf9c4 interface: "block.headers": nicer error if server uses too low 'max'
related 4ff6a9c4f0
2021-02-18 20:40:38 +01:00
ThomasV
d906819b03 minor fix following method rename 2021-02-18 13:36:54 +01:00
ThomasV
998f41256f Merge pull request #7041 from SomberNight/20200218_invoice_amt_oob
invoices: validate 'amount' not to be out-of-bounds
2021-02-18 12:01:48 +01:00
ThomasV
ba5e73d978 kivy: show routing options explicitly 2021-02-18 11:39:52 +01:00
ThomasV
880353287d lnrater: fix #6764 2021-02-18 10:59:45 +01:00
SomberNight
0aa36ab5ac invoices: validate 'amount' not to be out-of-bounds 2021-02-18 06:11:09 +01:00
SomberNight
24d47022b4 util: assert that Decimal precision is sufficient
Just for sanity... e.g. when importing electrum as a python library,
the calling code could have changed the precision.

related: #5223
2021-02-18 03:02:25 +01:00
SomberNight
b856336f8c bip32: add new test vectors from BIP
also yet-to-be-merged test from https://github.com/bitcoin/bips/pull/1030
2021-02-18 02:57:02 +01:00
ThomasV
bab22c8c53 minor: fix exception 2021-02-17 18:18:36 +01:00
ThomasV
0e23f33f59 kivy and qt: adapt open_channel dialogs to trampoline 2021-02-17 17:35:47 +01:00
ThomasV
cf818fe08c Trampoline routing:
- add support for trampoline forwarding
 - add regtest with trampoline payment
2021-02-17 17:28:56 +01:00
ThomasV
ded449233e Trampoline routing.
- trampoline is enabled by default in config, to prevent download of `gossip_db`.
   (if disabled, `gossip_db` will be downloaded, regardless of the existence of channels)
 - if trampoline is enabled:
    - the wallet can only open channels with trampoline nodes
    - already-existing channels with non-trampoline nodes are frozen for sending.
 - there are two types of trampoline payments: legacy and end-to-end (e2e).
 - we decide to perform legacy or e2e based on the invoice:
    - we use trampoline_routing_opt in features to detect Eclair and Phoenix invoices
    - we use trampoline_routing_hints to detect Electrum invoices
 - when trying a legacy payment, we add a second trampoline to the path to preserve privacy.
   (we fall back to a single trampoline if the payment fails for all trampolines)
 - the trampoline list is hardcoded, it will remain so until `trampoline_routing_opt` feature flag is in INIT.
 - there are currently only two nodes in the hardcoded list, it would be nice to have more.
 - similar to Phoenix, we find the fee/cltv by trial-and-error.
    - if there is a second trampoline in the path, we use the same fee for both.
    - the final spec should add fee info in error messages, so we will be able to fine-tune fees
2021-02-17 17:28:13 +01:00
ThomasV
f4fe80dfd1 kivy: show node alias in channels dialog. Rename the menu back to 'Channels' 2021-02-17 16:44:43 +01:00
Jin Eguchi
cba49db196 windows build: update gnupg(2.2.19-3ubuntu2.1) (#7030) 2021-02-16 23:27:29 +00:00
SomberNight
1dea8393d7 wallet: follow-up b080df9cff 2021-02-16 22:28:11 +01:00
ThomasV
1323bd4f9c open_channel_coroutine: do not timeout on sign_transaction. fixes #7027 2021-02-15 16:47:42 +01:00
SomberNight
01ed5e7345 wallet.bump_fee: (fix) method2 was bumping too much if output was rm-ed
regression from bafe8a2fff
2021-02-15 10:20:34 +01:00
SomberNight
b080df9cff wallet.bump_fee: (fix) make sure input signatures are removed
bump_fee was returning an invalid tx if its input was a
PartialTransaction that had signatures. It was relying on
line 1441 to remove signatures.

Relatedly, the WalletDB used to store such PartialTransactions as
PartialTransaction objects, but only until the program was restarted.
This is because serialising and de-serialising such a tx results in a
Transaction object.

So, combining these two, to reproduce a bug:
- create a tx, sign it, save as local
- bump fee, sign it, save as local
- bump fee --> tx already signed!? --> has old sigs, so it is invalid
2021-02-15 10:20:30 +01:00
SomberNight
4346d2fc76 synchronizer: ensure fairness between wallets
Scenario (prior to change):
User opens wallet1 with 10k addresses, and then immediately opens wallet2
with 100 addresses.
wallet1 will synchronise first, fully, and only then will wallet2 start syncing.

Now, wallet1 and wallet2 will sync concurrently (and wallet2 will finish much
sooner as expected).
2021-02-12 21:31:18 +01:00
SomberNight
83750a861f ledger: bump min btchip-python (0.1.30->0.1.32)
So that it has https://github.com/LedgerHQ/btchip-python/pull/42

fixes #6928
2021-02-12 05:28:01 +01:00
SomberNight
914eb9989d wallet: minor clean-up of tx.set_rbf() calls
Better to always call it, to make sure inputs have identical sequence numbers.
2021-02-12 04:59:40 +01:00
SomberNight
ca86e35724 wallet.bump_fee: (fix) make sure all inputs have same sequence number
Previously, if bump_fee decided to add new inputs to the tx, they would
have a different sequence number than the existing inputs. This was
unintentional.
2021-02-12 04:59:34 +01:00
SomberNight
b56fe237cd ledger: give clear error that old HW.1 cannot send to bech32 address
maybe related #7022
2021-02-12 04:47:53 +01:00
ThomasV
87a080d30e split code in htlc_switch:
- raise OnionRoutingFailure whenever we want to fail a htlc
 - catch that exception in htlc_switch
 - this will avoid code duplication in the case of trampoline
2021-02-11 06:19:17 +01:00
SomberNight
fa1762792a lntransport: CancelledError needs priority over LPConnClosed
Scenario (prior this change):
A task in lnpeer.Peer.taskgroup raises ORIG_EXC, e.g. in htlc_switch.
The taskgroup then cancels all its tasks and then awaits each (in cancel_remaining):
4e64c56042/aiorpcx/curio.py (L217-L221)
In Peer.main_loop, we would want ORIG_EXC to be raised,
but instead LightningPeerConnectionClosed() will be raised as
the Peer._message_loop() task is cancelled, and it is awaited first in cancel_remaining.
We should make sure that if a task is cancelled it will let the CancelledError
propagate out, or at least it does not raise a different exception instead.
2021-02-10 19:40:10 +01:00
ThomasV
2057185aa4 Merge pull request #7011 from zebra-lucky/make_payreq_details_network
make_unsigned_request: set network for testnet
2021-02-09 10:51:50 +01:00
zebra-lucky
c43729b076 make_unsigned_request: set network for testnet 2021-02-08 20:26:16 +02:00
ThomasV
42c10c2fec Separate pay_to_node logic from pay_invoice:
- pay_to_node will be needed to forward trampoline onions.
 - pay_to_node either is successful or raises
 - pay_invoice handles invoice status
2021-02-07 13:03:18 +01:00
ThomasV
2c2d3f3b30 handle_error_from_failed_htlc: blacklist channel if cannot decode payload 2021-02-07 12:34:28 +01:00
ThomasV
4febbcdc2d encapsulate get_routing_info in lnaddr 2021-02-07 12:21:00 +01:00
ThomasV
0c93394513 rename lnworker._pay to pay_invoice, call it directly from GUIs 2021-02-07 12:09:37 +01:00
Gordan Nekić
9c4807644b Fix ledger sign message (#7004)
there was an around ~1/128 chance of creating an invalid signature when signing a message with a ledger
2021-02-06 05:16:52 +00:00
bitromortac
2bffc9d3eb lnpeer: fix timed out mpp 2021-02-05 21:52:13 +01:00
ThomasV
c01ca101e0 minor: fix typo 2021-02-05 17:24:15 +01:00
ThomasV
34734bd229 cleanup, follow-up f28a2aae73 2021-02-05 17:09:47 +01:00
ThomasV
cc69cf3f33 Qt: fix deprecation warning 2021-02-05 16:43:00 +01:00
ThomasV
f28a2aae73 Reorganize code so that we can send Multi Part Payments:
- LNWorker is notified about htlc events and creates payment events.
 - LNWorker._pay is a while loop that calls create_routes_from_invoice.
 - create_route_from_invoices should decide whether to split the payment,
   using graph knowledge and feedback from previous attempts (not in this commit)
 - data structures for payment logs are simplified into a single type, HtlcLog
2021-02-05 14:28:58 +01:00
ThomasV
1102ea50e8 fix tests (follow-up previous commit) 2021-02-05 11:57:19 +01:00
ThomasV
ff8fc798f4 follow-up c0bf9b4509 2021-02-05 11:33:45 +01:00
ThomasV
ef5a265449 basic_mpp: receive multi-part payments 2021-02-04 16:31:17 +01:00
ThomasV
c0bf9b4509 LNWorker: do not save PR_INFLIGHT status, detect it on startup instead 2021-02-04 16:30:50 +01:00
ThomasV
51455c9d9a Merge pull request #6993 from zebra-lucky/pr_check_network
paymentrequest: check network on PaymentRequest parse
2021-02-04 09:56:58 +01:00
zebra-lucky
d53d4e46e6 paymentrequest: check network on PaymentRequest parse 2021-02-04 07:32:37 +02:00
rage-proof
cb3977798c add function to determine script-type for all inputs in a psbt (#6984)
* Add functions to determine the script type from a psbt.

* add a function inside PartialTransaction

* P2wsh uses the witness-script field to save the script.

* Limit the detection of script-types that are not multisig.
2021-02-04 02:52:40 +00:00
SomberNight
d34b8d69f6 build-wine/README.md: add comment about needing recent docker version
related:
https://github.com/spesmilo/electrum/issues/6971
https://github.com/spesmilo/electrum/pull/6981
2021-02-01 22:34:16 +01:00
Jin Eguchi
5d19d5d4bd Fix windows build(travis) (#6981) 2021-02-01 21:32:29 +00:00
SomberNight
337d4890a1 lnworker/swaps: add '_sat' suffix to arg names and force kwargs 2021-02-01 22:11:56 +01:00
SomberNight
3d1796ab1d follow-up prev: fix units when calling lnworker.create_invoice: msat/sat
follow-up e477a43385
2021-02-01 22:08:09 +01:00
ThomasV
e477a43385 PaymentInfo: use msat precision 2021-02-01 15:03:56 +01:00