Commit Graph
8753 Commits
Author SHA1 Message Date
carla 384c6aa1f1 chanfitness: save initial online event for channels with online peers
This commit adds an initial peer online event for channels
that have peers that are online when they are created. This
addresses a race between the peer coming online and an
existing channel being added to the event store; if the
peer comes online first, the existing channel will not have
its initial online event added.
2020-01-07 16:35:23 +02:00
Johan T. Halseth 3aca9d24b8 Merge pull request #3829 from halseth/pluggable-commitments-lnwallet
Pluggable commitments
2020-01-07 09:58:12 +01:00
Olaoluwa Osuntokun 08ebefa8a3 Merge pull request #3884 from bhandras/hotfix
routing: clean up locking on topology change
2020-01-06 18:00:38 -08:00
Olaoluwa Osuntokun a0c5d965a3 Merge pull request #3882 from philippgille/feature/fix-unclear-bools-in-config
config: Make bools in sample-lnd.conf consistent
2020-01-06 17:59:44 -08:00
Olaoluwa Osuntokun 79948ebe1c Merge pull request #3854 from matheusdtech/fix-hn-goroutine-leak
lntest: Don't leak node's grpc conn
2020-01-06 17:55:41 -08:00
Olaoluwa Osuntokun aab956471d Merge pull request #3846 from guggero/lntest-node-config
itest: make harnesses usable in external projects
2020-01-06 17:52:16 -08:00
Olaoluwa Osuntokun 66ff2c1e7a Merge pull request #3890 from guggero/custom-shared-key
signrpc: derive custom shared key
2020-01-06 13:42:14 -08:00
Oliver Gugger 4f98642b5e signrpc: derive custom shared key
With this commit we add the ability to create a shared DH key by using
a custom node private key instead of the node's identity private key.
If no key locator is specified the node's identity private key will be
used as a fallback.
2020-01-06 14:53:32 +01:00
Johan T. Halseth 9c3218c51e lnwallet/channel: reuse derived SingleTweak on local force close
When creating the keyring, the tweak is already calculated in the remote
commitment case. We add the calculation also for our own commitment, so
we can use it in all cases without deriving the tweak.
2020-01-06 12:08:29 +01:00
Johan T. Halseth 3711597fef input: remove duplicate commit weight constant 2020-01-06 12:08:25 +01:00
Johan T. Halseth a56ed72bd7 lnwallet: use channel type to derive remote script
Based on the current channel type, we derive the script used for the
to_remote output. Currently only the unencumbered p2wkh type is used,
but that will change with upcoming channel types.
2020-01-06 12:08:19 +01:00
Johan T. Halseth 9b5809a884 input: update SignDescriptor doc to note only segwit is supported
Also update the WitnessScript doc to note it should be set also for
p2wkh.
2020-01-06 12:08:14 +01:00
Johan T. Halseth f92c7a3af0 lnwallet: nil single tweak when creating keyring
To make the channel state machine less concerned about the type of
commitment, we nil the local tweak when creating the keyring, depending
on the commitment type.
2020-01-06 12:08:09 +01:00
Johan T. Halseth 5e3718a1b5 lnwallet: use channel type to derive keys
We abstract away how keys are generated for the different channel types
types (currently tweak(less)).

Intention is that more of the logic that is unique for each commitment
type lives in commitment.go, making the channel state machine oblivious
to the keys and outputs being created on the commitment tx for a given
channel state.
2020-01-06 12:08:05 +01:00
Johan T. Halseth 4fde31229c lnwallet: rename DelayKey->ToLocalKey, NoDelayKey->ToRemoteKey
Since both parties are going to have their ouputs delayed, we move way
from the DelayKey naming, and instead use ToLocalKey and ToRemoteKey.
2020-01-06 12:08:01 +01:00
Johan T. Halseth 7b9c54996b lnwallet/commitment: clarify keyring key ownership 2020-01-06 12:07:56 +01:00
Johan T. Halseth 76ce51301e lnwallet: return instead evaluated commitment instead of mutating
createCommitmentTx would earlier mutate the passed commitment struct
after evaluating the htlc view and calculating the final balances, which
was confusing since the balances are supposed to only be *after*
subtracting fees.

Instead we take the needed parameters as arguments, and return the final
balances, tx and fee to populate the commitment struct in a proper way.
2020-01-06 12:07:49 +01:00
Johan T. Halseth 613d771daf lnwallet: create CommitmentBuilder
We define a new struct CommitmentBuilder that will be used to craft the
final commitment transaction based on the current active channel type.
2020-01-06 11:42:03 +01:00
Johan T. Halseth 13a108e578 lnwallet: make fundingTxIn not depend on LightningWallet 2020-01-06 11:42:03 +01:00
Johan T. Halseth 83e0d47ba3 lnwallet: move methods to commitment.go
PURE CODE MOVE:
Moving createCommitmentTx, CreateCommitTx, createStateHintObfuscator,
CommitmentKeyRing, DeriveCommitmentKeys, addHTLC, genHtlcScripts

We move the methods and structs to a new file commitment.go in
preparation for defining all the logic that is dependent on the channel
type in this new file.
2020-01-06 11:42:03 +01:00
Johan T. Halseth fff9dbe6f3 lnwallet: pass chan cfgs to CreateCommitTx
Instead of passing delays and dustlimits separately, we pass the correct
channel config to CreateCommitTx from the POV of the local party that
owns the commit tx.

To make it more clear which commitment we are actually creating, we
rename variables to denote local and remote, to prepare for the case
when both outputs might be delayed.
2020-01-06 11:42:03 +01:00
Johan T. Halseth 1a4f81ed90 lnwallet: remove duplicate chanCfg fields, use channelState 2020-01-06 11:42:02 +01:00
Johan T. Halseth e2b050aca3 lnwallet: make addHtlc non-LightningChannel method
It has no dependency on LightningChannel
2020-01-06 11:42:02 +01:00
Johan T. Halseth f0019006a7 lnwallet: remove unused initiator param to CreateCooperativeCloseTx 2020-01-06 11:42:02 +01:00
Johan T. Halseth 2c46640dd0 channeldb+lnwallet: note that balance is after subtracting commit fee
It was incorrectly stated that the commitment balance was before
subctracting the commit fee, which led to some confusion.
2020-01-06 11:42:02 +01:00
Oliver Gugger ae1f7348f0 lntest: fix macaroon paths
This change makes sure that all macaroons are stored in the same
folder. This makes it possible to use the lntest package in external
projects that use loop's lndclient library which currently assumes
that the admin macaroon and subserver macaroons are in the same sub
folder of lnd's data directory.
2020-01-03 09:19:18 +01:00
Oliver Gugger ce711a1de7 lntest: specify lnd binary
Integration tests in external projects might not have the same folder
structure as lnd does. Therefore we want to allow the path to the
lnd itest binary to be configurable.
2020-01-03 09:17:23 +01:00
Oliver Gugger b762d441cf lntest: expose configuration of harness node
When using the lntest package for itests in external projects, it
is necessary to access a harness node's configuration, for example
to get its data directory on disk. This commit exports that
configuration.
2020-01-03 09:13:29 +01:00
Olaoluwa Osuntokun 22e1f006b1 Merge pull request #3870 from Septem151/rpc-autopilot-fix
Fix typo in "query" rpc for autopilot.
2020-01-02 16:03:05 -08:00
Olaoluwa Osuntokun 5ade9abe29 Merge pull request #3777 from guggero/shared-key
signrpc: add DeriveSharedKey
2020-01-02 16:02:47 -08:00
Andras Banki-Horvath 4e0ada9ea3 routing: clean up locking on topology change 2020-01-02 18:03:48 +01:00
Philipp Gille b6ea7d5f6c config: Make bools in sample-lnd.conf consistent 2019-12-29 14:12:06 +01:00
Olaoluwa Osuntokun f289a39c1a Merge pull request #3795 from joostjager/keysend
lncli+invoices: experimental key send mode
2019-12-24 17:38:46 -06:00
Joost Jager 4273bc0ba2 lntest/itest: add key send test 2019-12-23 21:51:27 +01:00
Joost Jager bb1e2afc9f lntest/itest: move single hop invoice test to separate file 2019-12-23 21:51:25 +01:00
Joost Jager b1206f67c2 lncli: send key
Extend lncli with a flag that indicates the intention to send
a spontaneous payment. lncli will generate a preimage/hash combination
and send the preimage as a custom record to the recipient.
2019-12-23 21:51:23 +01:00
Joost Jager c08865f4ae lnrpc/invoicesrpc: add is_key_send flag to rpc invoice 2019-12-23 21:51:21 +01:00
Joost Jager 1d5844c196 invoices: jit insert key send invoices
This commit adds handling code for the key send custom record. If this
record is present and its hash matches the payment hash, invoice
registry will insert a new invoice into the database "just in time". The
subsequent settle flow is unchanged. The newly inserted invoice is
picked up and settled. Notifications will be broadcast as usual.
2019-12-23 21:51:19 +01:00
Joost Jager 202b7c26a7 invoices: move lock acquisition down
Move in separate commit to make next commit more readable.
2019-12-23 21:51:17 +01:00
Joost Jager 6063dc31fc lnrpc/invoicesrpc: support empty payment request fields
Prepares for spontaneous key send payments that do not have a payment
request.
2019-12-23 21:51:15 +01:00
Joost Jager 15eedd2b1a lncli: remove debug send
Debug send has been removed some time ago. This is a left over.
2019-12-23 21:51:13 +01:00
Joost Jager af1b8a549d channeldb: update payment request comment
This field isn't optional. It was introduced in
5ed31b1030 which was part of release
0.4.0. This release contained breaking database changes, so it is safe
to assume that from there on the field is always populated.

If there would still be empty payment request fields in the wild, users
would also experience issues with ListInvoices. ListInvoices decodes the
payment request.
2019-12-23 21:51:11 +01:00
Joost Jager c89f0dc7c1 invoices/test: lower test delay
Previously 5 seconds was used, which made the otherwise fast registry
tests relatively slow.
2019-12-23 21:51:10 +01:00
Olaoluwa Osuntokun 7eacc40419 Merge pull request #3722 from Roasbeef/external-funding-rpc
lnrpc+lnwallet+funding: implement new RPCs to enable external channel funding
2019-12-23 14:41:46 -06:00
Olaoluwa Osuntokun e0d9bbfbc4 Merge pull request #3873 from matheusdtech/reenable-tests
Re-enable TestLightningWallet tests
2019-12-23 13:23:29 -06:00
Matheus Degiovani 5dffa7da1c lnwallet: Re-enable tests
Tests were erroneously disabled in commit b1940d67.
2019-12-23 10:32:03 -03:00
Matheus Degiovani 02d616d9b7 lnwallet: Fix external funding test 2019-12-23 10:31:03 -03:00
Carson Mullins 74d48510c8 Fix typo in "query" rpc for autopilot. 2019-12-22 20:19:36 -06:00
Olaoluwa Osuntokun 3de3ec8008 lntest/itest: add new test for external chan point funding 2019-12-20 19:09:56 -08:00
Olaoluwa Osuntokun be4db0ebca lntest: add optional FundingShim field to OpenChannelParams 2019-12-20 19:09:48 -08:00