Commit Graph

9344 Commits

Author SHA1 Message Date
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
Joost Jager
3aaf32dc2e
routing: improve equal cost route comparison
When the (virtual) payment attempt cost is set to zero, probabilities
are no longer a factor in determining the best route. In case of routes
with equal costs, we'd just go with the first one found. This commit
refines this behavior by picking the route with the highest probability.
So even though probability doesn't affect the route cost, it is still
used as a tie breaker.
2019-12-02 14:23:57 +01:00
Johan T. Halseth
260704f3cd
mobile: call Start callback when lnd ready, add unlock callback
Use the custom listeners' Ready channels to provide callbacks to the
mobile application when the gRPC services are ready.

NOTE: this changes the Start() API by adding one extra callback.
2019-11-29 11:59:01 +01:00
Johan T. Halseth
dc6c040803
lnd: make Ready signal for custom listeners
This allows the caller to know when lnd is ready to accept RPC calls,
which is inmportant for mobile applications where eveything happens in
process.
2019-11-29 11:59:01 +01:00
Oliver Gugger
a124bb24da
lntest: add unconfirmed channel SCB test 2019-11-28 08:59:38 +01: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
c15b0316a2
routing: use FailureReasonError for internal path finding errors 2019-11-27 15:21:12 +01:00
Joost Jager
b5f1bde604
routing: add error var for pre-built route tried 2019-11-27 15:21:10 +01:00
Joost Jager
ac2df9bbf4
routing: use simple errors for path finding 2019-11-27 15:21:08 +01:00
Joost Jager
6774b5a007
routing: remove unused error codes 2019-11-27 15:21:06 +01:00
Joost Jager
7e4f9dd70a
routing/test: simplify context instantiation 2019-11-26 21:40:30 +01: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
Matheus Degiovani
cf6ae06b30 zpay32: Add tests of checksum malleability
This adds tests for checksum malleability issue of bech32 strings as
used by LN invoices.
2019-11-26 17:09:35 -03:00
Matheus Degiovani
409cf55655 zpay32: Fix broken last tagged field
This fixes an issue where the last tagged field of an invoice could get
broken due to the malleability of bech32 checksums.

The addition of a specific character in the second to last position of
the checksum could cause the previous signature field to mutate and thus
point to a different public node.
2019-11-26 14:26:03 -03:00
Matheus Degiovani
85f9c03797 zpay32: Switch to ErrInvalidFieldLength sentinel
This switches the applicable error to use an exported sentinel error so
that it is more testable.
2019-11-26 14:26:03 -03:00
Johan T. Halseth
e8e5fd7abc
mobile: run goimports on generated files
Subservers might depend on each other (notably walletrpc depends on
signrpc) so running goimports ensures they properly import each other.
2019-11-26 14:57:17 +01:00
Oliver Gugger
fb683f74a4
chanbackup: set funding broadcast height on restore 2019-11-26 14:45:22 +01:00
Oliver Gugger
d4f836ecb3
chanbackup: encode broadcast height in chan ID for unconfirmed channels 2019-11-26 14:45:21 +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