Commit Graph

114 Commits

Author SHA1 Message Date
eugene
e0859e121f multi: add fmgr.Manager interface, change usage in peer to use Manager
This gets rid of several config functions in the peer and should pave
the way for easier testing of the funding manager and peer.
2020-10-01 10:27:13 -04:00
Calvin Zachman
f5fb64e552 add new max channel size config option
- let users specify their MAXIMUM WUMBO with new config option which sets the maximum channel size lnd will accept
- current implementation is a simple check by the fundingManager rather than anything to do with the ChannelAcceptor
- Add test cases which verify that maximum channel limit is respected for wumbo/non-wumbo channels
- use --maxchansize 0 value to distinguish set/unset config. If user sets max value to 0 it will not do anything as 0 is currently used to indicate to the funding manager that the limit should not be enforced. This seems justifiable since --maxchansize=0 doesn't seem to make sense at first glance.
- add integration test case to ensure that config parsing and valiation is proper. I simplified the funding managers check electing to rely on config.go to correctly parse and set up either i) non wumbo default limit of 0.16 BTC OR ii) wumbo default soft limit of 10 BTC

Addresses: https://github.com/lightningnetwork/lnd/issues/4557
2020-09-14 21:16:32 -05:00
eugene
4ff03afee0 lnd: move fundingBroadcastHeight to fundingmanager_test.go 2020-08-31 19:42:53 -04:00
eugene
c7cbacc35b multi: move mockChainIO, mockNotifier to lntest/mock 2020-08-31 19:41:09 -04:00
eugene
3fa5d042c9 multi: move mockWalletController, mockSecretKeyRing to lntest/mock 2020-08-31 18:36:05 -04:00
eugene
49d8f04197 multi: migrate instances of mockSigner to the mock package
This commit moves all localized instances of mock implementations of
the Signer interface to the lntest/mock package. This allows us to
remove a lot of code and have it housed under a single interface in
many cases.
2020-08-28 15:43:51 -04:00
Conner Fromknecht
d04df11c44
Merge pull request #4505 from Crypt-iQ/activeNet_cleanup_0803
lnd: removing activeNetParams global, passed around instead via configs
2020-08-20 12:59:15 -07:00
nsa
3791c9efcb lnd: removing activeNetParams global, passed around instead via configs
This commit removes the activeNetParams global in chainparams.go. This
is necessary to isolate code from the lnd package so we can import it
for use in tests, other projects, etc.
2020-08-11 11:41:24 -04:00
carla
2a614cc596
multi: add labels to lnd native transactions
Follow up labelling of external transactions with labels for the
transaction types we create within lnd. Since these labels will live
a life of string matching, a version number and rigid format is added
so that string matching is less painful. We start out with channel ID,
where available, and a transaction "type". External labels, added in a
previous PR, are not updated to this new versioned label because they
are not lnd-initiated transactions. Label matching can check this case,
then check for a version number.
2020-07-29 13:46:07 +02:00
Olaoluwa Osuntokun
8177fed302
funding: allow incoming wumbo channel requests if wumbo is enabled 2020-07-10 16:27:15 -07:00
Wilmer Paulino
9e8c39d4a2
Merge pull request #971 from vctt94/addMaxValueFlag
Add max value in flight flag
2020-07-07 10:29:51 -07:00
nsa
cbd54101f8 multi: remove peer.go, change all references to point to peer pkg 2020-07-06 19:16:07 -04:00
vctt94
2f6a8b13ae fundingmanager: Add max value to fundingmanager and fundingmanager_test 2020-07-03 11:09:40 -03:00
carla
75370ce6b4
multi: update WalletController PublishTransaction to include label
Add label parameter to PublishTransaction in WalletController
interface. A labels package is added to store generic labels that are
used for the different types of transactions that are published by lnd.

To keep commit size down, the two endpoints that require a label
parameter be passed down have a todo added, which will be removed in
subsequent commits.
2020-05-19 13:30:00 +02:00
Olaoluwa Osuntokun
c2516d9352
Merge pull request #4286 from guggero/remove-global-cfg
multi: remove global cfg variable
2020-05-18 19:45:43 -07:00
Olaoluwa Osuntokun
280bf8d26c
Merge pull request #4226 from breez/fix-chainrpc-crash
Fix crash when ChainNotifier is being accessed too early.
2020-05-15 16:17:40 -07:00
Oliver Gugger
7ce70321ac
fundingmgr+server: don't use global cfg 2020-05-14 16:18:01 +02:00
Oliver Gugger
3b2188d689
multi: move exported items to lncfg 2020-05-14 14:37:51 +02:00
Oliver Gugger
409d2c9a90
lnd+config: export config struct and LoadConfig
As a preparation to be moved to the lncfg package, the main struct and
functions related to configuration are exported.
2020-05-14 13:05:01 +02:00
Roei Erez
ae2c37e043 Ensure chain notifier is started before accessed.
The use case comes from the RPC layer that is ready before the
chain notifier which is used in the sub server.
2020-04-30 12:54:33 +03:00
Andras Banki-Horvath
556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Conner Fromknecht
0f94b8dc62
multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Conner Fromknecht
ec784db511
multi: remove returned error from WipeChannel
The linter complains about not checking the return value from
WipeChannel in certain places. Instead of checking we simply remove the
returned error because the in-memory modifications cannot fail.
2020-04-02 17:39:29 -07:00
Oliver Gugger
182835d504
fundingmgr+channelnotifier: add channel config to pending chan ntfn
To be able to write a new channel backup file for pending channels,
we need to include the channel configuration in the pending channel
notification event.
2020-02-14 10:04:26 +01:00
Hampus Sjöberg
227e66c469 rpc: Add PendingOpenChannel to SubscribeChannelEvents
This commit adds PendingOpenChannel to SubscribeChannelEvents stream in
the gRPC API.
This is useful for keeping track of channel openings that Autopilot does.
It can also be used for the non-initator side of a channel opening to keep
track of channel openings.
2020-01-24 13:48:18 +01:00
Joost Jager
ddb98fcc41
multi: distinguish between htlc in and out constraints 2019-12-11 00:16:57 +01:00
carla
9b35c349de
multi: Set upfront shutdown from open and accept chanel messages
This commit gets upfront shutdown scripts from openchannel and
acceptchannel wire messages sent from our peer and sets upfront
shutdown scripts in our open and accept channel messages when
the remote peer supports option upfront shutdown and we have
the feature enabled.
2019-12-03 11:38:29 +02: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
Conner Fromknecht
16318c5a41
multi: merge local+global features from remote peer 2019-11-08 05:31:47 -08:00
Olaoluwa Osuntokun
777ed104a3
chainfee: create new chainfee package extracting fees from lnwallet
In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
2019-10-31 16:41:57 -07:00
Olaoluwa Osuntokun
3f8526a0ca
peer+lnpeer: add new methods to expose local+global features for lnpeer interface 2019-09-25 18:26:01 -07:00
Olaoluwa Osuntokun
b1d122773e
Merge pull request #1910 from halseth/fundingmanager-state-machine
Fundingmanager state machine cleanup
2019-09-25 16:31:51 -07:00
nsa
4d02100e12
fundingmanager+server: adding ChannelAcceptor to the fundingmanager 2019-09-25 12:07:30 -04:00
Johan T. Halseth
30614d3840
funding tests: increase epoch channel buffer
Since the initiator no longer registers for block epochs, we increase
the buffer on the mocked channel to not block during tests.
2019-09-24 21:24:39 +02:00
Johan T. Halseth
5d1a7b0e7d
funding test: correctly send remote peer on connected chan 2019-09-24 21:24:32 +02:00
Johan T. Halseth
0db9045e11
funding test: mark assert methods t.Helper 2019-09-24 21:24:32 +02:00
Johan T. Halseth
33fe09482b
lnwire+multi: define Error() for lnwire.Error
To make lnwire.Error actually satisfy the error interface, define the
Error method directly.
2019-09-20 10:55:21 +02:00
Joost Jager
3d7de2ad39
multi: remove dead code 2019-09-10 17:21:59 +02:00
Johan T. Halseth
0405703019
fundingmanager test: add TestFundingManagerFundAll
TestFundingManagerFundAll tests that we can initiate a funding request to
use the funds remaining in the wallet. This should produce a funding tx with
no change output.
2019-07-18 00:58:12 +02:00
Johan T. Halseth
2cd7d5a2a4
fundingmanager test: extract publishing logic into fundChannel, set funding fee during unit tests 2019-07-18 00:58:12 +02:00
Johan T. Halseth
78da62c6f7
fundingmanager tests: run tests in parallel 2019-07-18 00:33:14 +02:00
Johan T. Halseth
452ee6aad4
fundingmanager+server: define MaxPendingChans. RejectPush in funding config
This commit makes the funding manager access the MaxPendingChannels and
RejectPush values from the fundingConfig instead of the global config
struct.

Done to avoid sharing state between tests.
2019-07-18 00:33:14 +02:00
Federico Bond
9bd3055fb8 discovery,fundingmanager: avoid serialization in NotifyWhenOnline 2019-06-04 16:36:21 -03:00
Joost Jager
dff0387363
lntest: move itest into package 2019-05-28 21:43:23 +02:00
Conner Fromknecht
08654786ad
fundingmanager: bump max non-initiator funding timeout to 2 weeks
The previous value was set to two days, which may not be enough to
handle large fee spikes where users still which to submit channels with
a low fee and don't mind lowering their time preference. Since the
timeout is only applied to channels that we don't initiate, there's real
downside since it's not our funds that are locked up.
2019-05-18 15:21:56 -07:00
Johan T. Halseth
b53899c43c
lnd: rename package main->lnd 2019-04-23 20:57:33 +02:00
Wilmer Paulino
760f38736e
fundingmanager: populate additional edge info after adding to graph
This commit serves as another stop-gap for light clients since they are
unable to obtain the capacity and channel point of graph edges. Since
they're aware of these things for their own channels, they can populate
the information within the graph themselves once each channel has been
successfully added to the graph.
2019-04-18 21:57:40 -07:00
Conner Fromknecht
f39edd8000
peer: add SendMessageLazy 2019-03-05 17:08:22 -08:00
Valentine Wallace
5405028948 fundingmanager: inform ChannelNotifier about newly open channels. 2019-02-05 18:17:54 -08:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00