Commit Graph

8427 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
f2f79d3990
Merge pull request #3659 from Roasbeef/external-funding-chanfunding
chanfunding: create new package to abstract over funding workflows
2019-12-02 18:13:38 -06:00
Olaoluwa Osuntokun
b1940d6779
lnwallet: fix bug in verifyFundingInputs skip dual funder tests for neutrino
In this commit, we fix a long standing bug within the newly created
`verifyFundingInputs` method. Before this commit, the method would
attempt to derive the pkScript by looking at the last items on the
witness stack, and making a p2wsh output script from that. This is
incorrect as typically non of these scripts will actually be p2wsh, and
instead will be p2wkh. We fix this by using the newly available
`txscript.ComputePkScript` method to derive the proper pkScript.

This resolves an issue w.r.t passing incorrect arguments for all
backends, but an issue still stands for the neutrino backend. As is, we
pass a height hint of zero into the `GetUtxo` method call. With the way
the current utxo scanner is set up for neutrino, this'll cause it to
never find the UTXO, as it takes the height hint as a UTXO birth height,
rather than a lower bound of the birth of the UTXO.
2019-12-02 17:12:05 -06:00
Olaoluwa Osuntokun
6b729ec9f5
lnwallet: break early in TestLightningWallet when a sub-test fails 2019-12-02 17:11:58 -06:00
Olaoluwa Osuntokun
c3a7da5ce7
lnwallet: add new test to exercise external channel funding 2019-12-02 17:11:54 -06:00
Olaoluwa Osuntokun
9926259da0
lnwallet: add new RegisterFundingIntent method
In this commit, we add a new method `RegisterFundingIntent` that allows
a caller to "inject" a pre-populated chanfunding.Intent into a funding
workflow. As an example, if we've already agreed upon the "shape" of the
funding output _outside_ the protocol, then we can use this to pass down
the details of the output, then leverage the normal wire protocol to
carry out the remainder of the funding flow.
2019-12-02 17:11:51 -06:00
Olaoluwa Osuntokun
6e9cbc19f9
lnwallet+funding: pass the pending channel ID into the reservation context
In this commit, we start to thread the pending channel ID from wire
protocol all the way down into the reservation context. This change will
allow negotiation to take place _outside_ the protocol that may result
in a particular chanfunding.Assembler being dispatched.
2019-12-02 17:11:46 -06:00
Olaoluwa Osuntokun
c3157ae2c4
lnwallet: add awareness of chanfunding.ShimIntents
In this commit, we make the wallet aware of the second type of funding
intent: the ShimIntent. If we have one of these, then we don't need to
construct the funding transaction, and can instead just obtain the
outpoint directly from it.
2019-12-02 17:11:41 -06:00
Olaoluwa Osuntokun
7a64a7d3a4
lnwallet: delegate all channel funding logic to the new chanfunding package
In this commit, we begin to integrate the new channel funding package
into the existing codebase. With this set of changes, we'll no longer
construct and sign the funding transaction within this package, instead
delegating it to the new chanfunding package. We use the new
chanfunding.WalletAssembler to carry out all channel funding, providing
it with an implementation of all its interfaces backed by the wallet.
2019-12-02 17:11:36 -06:00
Olaoluwa Osuntokun
d422ebbc66
lnwallet/chanfunding: introduce new channel funding abstractions
In this commit, we introduce a series of new abstractions for channel
funding. The end goal is to enable uses cases that construct the funding
transaction externally, eventually handing the funding outpoint to lnd.
An example of such a use case includes channel factories and external
channel funding using a hardware wallet.

We also add a new chanfunding.Assembler meant to allow external channel
funding in contexts similar to how channel factories
can be constructed. With this channel funder, we'll only obtain the
channel point and funding output from it, as this alone is enough to
carry out a funding flow as normal.
2019-12-02 17:11:32 -06:00
Olaoluwa Osuntokun
4e955dfac6
lnwallet: remove unused openChanDetails struct
We also remove some related and also unused attributes as well along the
way.
2019-12-02 17:11:29 -06:00
Olaoluwa Osuntokun
9eefdef262
chanfunding+lnwallet: move coin selection code into new chanfunding package
In this commit, we make an incremental change to move the existing coin
selection code into a new chanfunding package. In later commits, this
package will grow to serve all the lower level channel funding needs in
the daemon.
2019-12-02 17:11:25 -06:00
Olaoluwa Osuntokun
f9d22cd900
funding: only broadcast the funding transaction if we actually have it 2019-12-02 17:11:21 -06:00
Olaoluwa Osuntokun
6753a02439
channeldb: add new NoFundingTxBit modifier to ChannelType
In this commit, we add a new bit to the existing ChannelType bitfield.
If this bit is set, then it signals that we have the funding transaction
stored on disk. A future change will enable lnd to have the funding
transaction be constructed externally, allowing for things like funding
from a hardware wallet, or a channel created as a sub-branch within an
existing channel factory.
2019-12-02 17:11:16 -06:00
Olaoluwa Osuntokun
d59aba35a0 Merge branch 'refresh-chan-id' 2019-11-27 15:21:42 -06:00
Olaoluwa Osuntokun
5bdb0d3d66
channeldb+lntest: code style fixes 2019-11-27 15:21:28 -06:00
Roei Erez
8b3dd9415e channeldb: refresh channel state within RefreshShortChanID
Refresh channel memory state whenever the short channel id is refreshed.
This is to make the in-memory channel consistent with the disk data.

Fixes #3765.
2019-11-27 15:10:00 -06:00
Joost Jager
949a5c5a04
Merge pull request #3736 from joostjager/route-to-self
routing: allow route to self
2019-11-26 21:37:31 +01:00
Joost Jager
2d19201ede
lnrpc+routerrpc+lncli: add allow_self_payments safety flag 2019-11-26 10:15:46 +01:00
Joost Jager
f8e9efbf99
routing: allow route to self 2019-11-26 10:15:44 +01:00
Joost Jager
81b7798c03
routing: pop heap at the end of the loop
This prepares for routing to self.
2019-11-26 10:15:42 +01:00
Joost Jager
683282fa24
routing: check loop conditions at end
This prepares for routing to self. When checking the condition at the
start, the loop would terminate immediately because the source is equal
to the target.
2019-11-26 10:15:40 +01:00
Joost Jager
2b332893b7
routing/test: add test focusing on not having a cycle 2019-11-26 10:15:38 +01:00
Olaoluwa Osuntokun
cb2b8b4513
Merge pull request #3693 from cfromknecht/tlv-invoice
migrate to tlv for invoice body
2019-11-25 18:00:52 -06:00
Olaoluwa Osuntokun
ff268ac39d
Merge pull request #3748 from halseth/falafel-updates
[mobile] Update readme and comments
2019-11-25 17:27:00 -06:00
Olaoluwa Osuntokun
be4a1a2704
Merge pull request #3759 from wpaulino/travis-bitcoind-0.19.1
build: bump travis bitcoind version to 0.19.0.1
2019-11-25 17:25:18 -06:00
Wilmer Paulino
75dbfba4ec
lntest: lower cpfp fee due to new bitcoind max fee restriction 2019-11-25 12:40:01 -08:00
Wilmer Paulino
44fa28b27b
build: bump travis bitcoind version to 0.19.0.1 2019-11-25 10:59:00 -08:00
Conner Fromknecht
59c4db7f33
Merge pull request #3756 from cfromknecht/non-verbose-unit-tests
Makefile: non-verbose unit tests
2019-11-24 06:39:31 -08:00
Conner Fromknecht
a83958408d
Merge pull request #3648 from cfromknecht/safe-disconnect
config+itest: allow unsafe disconnect by default
2019-11-22 21:07:17 -08:00
Olaoluwa Osuntokun
74849e7325
Merge pull request #3737 from guggero/resume-scb
chanbackup: continue recovery if channel already exists
2019-11-22 19:40:47 -08:00
Olaoluwa Osuntokun
6356316a4c
Merge pull request #3757 from cfromknecht/fix-nanonsecond-typo
lnrpc: fix nanonsecond typo
2019-11-22 16:24:41 -08:00
Conner Fromknecht
4c5b251748
Merge pull request #3750 from halseth/itest-flake-replacement-forceclose
lnd_test: fix race condition on simultanous force closes
2019-11-22 13:59:31 -08:00
Conner Fromknecht
b07fb37c34
Merge pull request #3751 from halseth/itest-numactivenodes-mtx
lntest/node: add numActiveNodesMtx
2019-11-22 13:56:45 -08:00
Conner Fromknecht
dd13a3c0d8
Makefile: make unit tess non-verbose
Makes it easier to spot failures without scrolling through pages of
successful tests.
2019-11-22 12:29:02 -08:00
Conner Fromknecht
9287610b83
lnrpc: fix nanonsecond typo 2019-11-22 12:23:35 -08:00
Wilmer Paulino
0c83a066e9
Merge pull request #3754 from dennisreimann/patch-1
Document setting multiple tlsextra entries
2019-11-22 10:41:22 -08:00
Joost Jager
43d2e7528e
Merge pull request #3493 from joostjager/small-successes
routing: track amt ranges in mission control
2019-11-22 14:46:30 +01:00
Conner Fromknecht
3b253e05f6
multi: restructure invoice Terms field
This commit restructures an invoice's ContractTerms to better encompass
the restrictions placed on settling. For instance, the final ctlv delta
and invoice expiry are moved from the main invoice body (where
additional metadata is stored). Additionally, it moves the State field
outside of the terms since it is rather metadata about the invoice
instead of any terms offered to the sender in the payment request.
2019-11-22 02:25:02 -08:00
Conner Fromknecht
6cabea563e
channeldb/invoices: optimize deserializeHtlcs
Instead of allocating a byte slice to read in each htlc's raw TLV
stream, use a LimitReader to truncate the stream to the proper length.
2019-11-22 02:24:44 -08:00
Conner Fromknecht
4c872c438b
channeldb: complete migration 12 for TLV invoices 2019-11-22 02:24:28 -08:00
Conner Fromknecht
76682ad820
channeldb/migration12: add tlv invoice migration tests 2019-11-22 02:24:11 -08:00
Conner Fromknecht
4b358aa2ad
channeldb/migration12: write out invoices using TLV encoding 2019-11-22 02:23:59 -08:00
Conner Fromknecht
0f8048d336
channeldb/migration12: copy invoice deserialization 2019-11-22 02:23:47 -08:00
Conner Fromknecht
c6a01f02cd
lnwire/features: add Encode256 and Decode256
These will allow us to serialize invoice features bits without double
encoding the length.
2019-11-22 02:23:35 -08:00
Conner Fromknecht
76a2dfd8a6
lnrpc: remove receipt field from invoice 2019-11-22 02:23:24 -08:00
Joost Jager
cdf1aa5bc1
routing: track amt ranges in mc 2019-11-22 11:17:28 +01:00
Joost Jager
62f8cca75b
routing+routerrpc: also expose amt for success results in mc 2019-11-22 11:17:26 +01:00
Dennis Reimann
dcfeebaa1b
Document setting multiple tlsextra entries
Minor addition to #2704, because I was wondering how to set multiple tlsextra entries.
2019-11-22 10:22:28 +01:00
Olaoluwa Osuntokun
6f9fcfaccc
Merge pull request #3499 from cfromknecht/mpp-payments-rpc
channeldb+rpcserver: expose legacy payments as multi-path payments
2019-11-21 18:38:53 -08:00
Johan T. Halseth
ddbd7a68ac
lntest/node: add numActiveNodesMtx
Fixes a slight race condition that could happen since Alice and Bob are
created in different goroutines, leading to using the same listening
ports.
2019-11-21 13:57:30 +01:00