Commit Graph

2948 Commits

Author SHA1 Message Date
Benjamin Congdon 92ac81b3b0
lnd+server: Allow configurable Node Alias and Color
This commit sets the Node's Alias and Color to the values set in config.
2018-01-18 09:31:48 -06:00
Benjamin Congdon a40ee8fe8a
config: Add settings for Alias and Color
This commit adds configuration variables for setting the Color and Alias
of the Node.
2018-01-18 07:39:37 -06:00
Benjamin Congdon ecff8f2a07
lnwire: Trim zero-bytes from NodeAlias String representation
This commit alters the NodeAlias String method to trim null-bytes from
the end of the alias. This is helpful for presentation in contexts such
as the GetInfo response.
2018-01-18 07:39:37 -06:00
Benjamin Congdon f1f1c8a257
rpc: Remove SetAlias and add Alias to GetInfo Response
This commit removes the SetAlias RPC function because it was deemed
unnecessary. This commit also populates the Alias field in the GetInfo
response
2018-01-18 07:39:37 -06:00
Maarten Tutak a8728ccb5b docs: add example of Java gRPC client 2018-01-18 12:47:54 +01:00
romanornr d512642c02 Travis: fix sudo required and apt-get update command 2018-01-17 10:06:40 -07:00
Olaoluwa Osuntokun 7b6f4d34b1
docker: fix stray quote in start-lnd.sh
Fixes #613.
2018-01-16 17:19:40 -08:00
Olaoluwa Osuntokun ebd97b83f3
discovery: ensure we only send node announcements that have active channels 2018-01-16 17:18:21 -08:00
Alex 3da0e2011b docker, docs, sample-lnd.conf: update examples for new command-line options 2018-01-15 14:56:21 -08:00
Alex 1305a4fedf build: update travis to install bitcoind for running tests 2018-01-15 13:59:34 -08:00
Alex db55569bac chainntfns: stop neutrino service before closing DB in interface_test.go 2018-01-15 13:59:34 -08:00
Alex 9a02884d0b main/lntest: factor out node config options, add options for bitcoind
This commit factors out the btcd and ltcd options into their own sections
similar to neutrino, and adds a bitcoind section as well. Now, you specify
node options similarly to:

--ltcd.rpchost=...
or
--btcd.rpcuser=...
or
--bitcoind.zmqpath=...

For Bitcoin, you specify an alternate back-end to btcd as follows:

--bitcoin.node=bitcoind
or
--bitcoin.node=neutrino

You can also specify the default option:
--bitcoin.node=btcd

For Litecoin, only `btcd` mode is valid, and corresponds to the `ltcd`
section. For example:

--litecoin.node=btcd
--ltcd.rpchost=...

The new code also attempts to read the correct options and auth info
from bitcoin.conf just as it does from btcd.conf/ltcd.conf.
2018-01-15 13:59:34 -08:00
Alex 187f59556a multi: add bitcoind drivers and tests 2018-01-15 13:59:34 -08:00
Johan T. Halseth 244ae4b571
Merge pull request #605 from timo-schmid/master
rpc: remove SetAlias from the rpc docs
2018-01-15 11:33:11 +01:00
Timo Schmid 9ab2ab0424
rpc: remove SetAlias from the rpc docs 2018-01-13 21:29:15 +01:00
Olaoluwa Osuntokun db06a8a7ee
Merge pull request #506 from halseth/dynamic-channel-params
Dynamic and user definable channel params
2018-01-12 15:38:12 -08:00
Johan T. Halseth d030773c8d
lnd test: add testUpdateChannelPolicy
This commit adds a new integration test, that checks that
policy/fee updates get propagated properly in the network,
such that the other nodes learn about the changes.
2018-01-12 22:57:05 +01:00
Johan T. Halseth f4f024aff2
lnd_test: extract graph topology subscription into own method
This commit extracts the launching of a goroutine subscribing
to and forwarding graph topology notifications into its own
utility method, such that it can be used in other tests as
well.
2018-01-12 22:57:04 +01:00
Johan T. Halseth 483abbee5b
discovery: make sure ChannelUpdates always have incremented timestamp
This commit ensures that we always increment the timestamp of
ChannelUpdates we send telling the network about changes to
our channel policy. We do this because it could happen
(especially during tests) that we issued an update, but the
ChannelUpdate would have the same timestamp as our last
ChannelUpdate, and would be ignored by the network.
2018-01-12 22:57:03 +01:00
Johan T. Halseth 43d7dd3d99
lnd: make NumRequiredConfs and RequiredRemoteDelay scale with chanAmt
This commit makes the value returned fomr NumRequiredConfs
and RequiredRemoteDelay used during the funding process scale
linearly with the channel size. This is done to ensure that
in cases there are more at stake in a channel, we have more
time to react to reorgs, or unilateral closes.

If the user explicitly specified values for these two at
startup, we return those instead, without doing the scaling.
2018-01-12 22:57:02 +01:00
Johan T. Halseth 3edc1a7456
fundingmanager: define min and maxRemoteDelay
This commit defines minRemoteDelay and maxRemoteDelay,
which is the extremes of the CSV delay we will require
the remote to use for its commitment transaction. The
actual delay we will require will be somewhere between
these values, depending on channel size.
2018-01-12 22:57:01 +01:00
Johan T. Halseth 53b0ee3765
lntest/node: use --bitcoin.defaultchanconfs=1 and --bitcoin.defaultremotedelay=4 2018-01-12 22:57:00 +01:00
Johan T. Halseth 4ee3bff771
lnd: use cfg.Bitcoin.DefaultNumChanConfs 2018-01-12 22:56:59 +01:00
Johan T. Halseth 0815bd4eb0
config: make DefaultNumChanConfs part of chainConfig
This commit moves the definition of DefaultNumChanConfs into
the chainConfig (such that it is set as e.g.
"--bitcoin.defaultchanconfs"), making it possible to set
individually for different chains.

It also adds the flag DefaultRemoteDelay to the chainConfig,
which can be used to set the CSV delay we will require the remote
to wait before retrieving its own funds in case of an
uncooperative close of the channel.

Both these are set 0 by default (if not specified by the user),
which in that case we will dynamically set the values, scaling
them according to the channel size.
2018-01-12 22:56:54 +01:00
Johan T. Halseth 633878d497
funding test: return static num conf instead of default value 2018-01-12 22:56:52 +01:00
Johan T. Halseth 10bd46ac72
chainregistry: use forwarding policy rules from config
This commit removes the definitions of
defaultBitcoinForwardingPolicy and defaultLitecoinForwardingPolicy
from the the chainregistry, and instead creates a routingPolicy
from the values found in the config.
2018-01-12 22:56:44 +01:00
Johan T. Halseth f1c6d40db8
lnd_test: use defaultBitcoinTimeLockDelta instead of defaultBitcoinForwardingPolicy.TimeLockDelta 2018-01-12 22:56:42 +01:00
Johan T. Halseth 1f6268cdde
rpcserver: use cfg.Bitcoin.TimeLockDelta as default CLTVExpiry for invoices 2018-01-12 22:56:41 +01:00
Johan T. Halseth f4feb1e697
config: add forwarding policy rules to config
This commit moves the forwarding policy rules for Bitcoin
and Litecoin, previously defined in the chainregistry, to
config.go, making them possible to define by the user.
We validate that the TimeLockDelta set is at least 4, the
other rules we let the user specify arbitrarily, even 0.
2018-01-12 22:56:40 +01:00
Johan T. Halseth 79a6efe33f
fundingmanager: use minHtlc from initFundingMsg
This commit makes the fundingmanager read the minHtlc
field of the initFundingMsg, and add it to the reservation
as this node's htlc_minimum_msat for the open_channel
message. If the field is not specified in the initFundingMsg,
the default value found in the DefaultRoutingPolicy will
be used.
2018-01-12 22:56:39 +01:00
Johan T. Halseth 7805a53c34
pilot: pass minHtlc = 1 satoshi to OpenChannel 2018-01-12 22:56:39 +01:00
Johan T. Halseth f3dff2ae97
rpcserver: add min_htlc_msat parameter to OpenChannel and OpenChannelSync 2018-01-12 22:56:38 +01:00
Johan T. Halseth 84e5adcdd0
server: add min_htlc_msat parameter to OpenChannel method 2018-01-12 22:56:37 +01:00
Johan T. Halseth 59b331c04d
lncli: add min_htlc_msat to openchannel 2018-01-12 22:56:36 +01:00
Johan T. Halseth e27f524309
lnrpc: add min_htlc_msat to OpenChanneRequest 2018-01-12 22:56:35 +01:00
Johan T. Halseth c4139b9f89
rpcserver: rename UpdateFees -> UpdateChannelPolicy
This commit changes the name of the UpdateFee method to
UpdateChannelPolicy, to mimic the recent proto change.
It also reads and validates the passed TimeLockDelta,
and sends it to the gossiper for announcing it to the
network, and to the switch for updating the forwarding
policy of the links.
2018-01-12 22:56:34 +01:00
Johan T. Halseth 26421031e2
lncli: rename updatefees to updatechanpolicy
This commit renames the `lncli updatefees` command to
`lncli updatechanpolicy` and adds `time_lock_delta` as
one of the passed parameters.
2018-01-12 22:56:34 +01:00
Johan T. Halseth 551326586c
lnrpc: rename UpdateFee -> UpdateChannelPolicy
This commit renames the UpdateFee RPC call together
with associated types to UpdateChannelPolicy. In addition
to fees, now also timelock delta can be specified using
this call.
2018-01-12 22:56:33 +01:00
Johan T. Halseth 8370fa2cde
discovery/gossiper: apply TimeLockDelta to edge when processing policy update
Also rename various instances of "FeeUpdate" to "PolicyUpdate"
2018-01-12 22:56:32 +01:00
Johan T. Halseth 0b8e7ff836
routing: embed FeeSchema in ChannelPolicy
This commit embeds the FeeSchema within the new
struct ChannelPolicy, which also contains the
TimeLockDelta for a channel.
2018-01-12 22:56:31 +01:00
Johan T. Halseth 9bdb483757
htlcswitch/link: make MinHTLC non-changable
This commit specifies that the MinHTLC value for a link is static
over the lifetime of a channel, and don't process the field
during a policyUpdate.
2018-01-12 22:56:29 +01:00
Olaoluwa Osuntokun a3f2bdebbf
Merge pull request #577 from halseth/test-log-testcase-start
Add integration test case name to node output
2018-01-12 12:05:14 -08:00
Olaoluwa Osuntokun 9992612d96
Merge pull request #581 from cfromknecht/handle-nil-spend-report
Properly Handle Nil Spend Report from Neutrino Rescan
2018-01-11 22:47:53 -08:00
Olaoluwa Osuntokun 6f408004e2
lnrpc+rpc: remove SetAlias method
In this commit we remove the SetAlias method as it’s being removed in
favor of instead using a static configuration parameter.
2018-01-10 15:16:46 -08:00
Olaoluwa Osuntokun d70e4bb0a0
routing: account for case where final destination send TemporaryChannelFailure
In this commit, we fix an existing bug that could cause lnd to crash if
we sent a payment, and the *destination* sent a temp channel failure
error message. When handling such a message, we’ll look in the nextHop
map to see which channel was *after* the node that sent the payment.
However, if the destination sends this error, then there’ll be no entry
in this map.

To address this case, we now add a prevHop map. If we attempt to lookup
a node in the nextHop map, and they don’t have an entry, then we’ll
consult the prevHop map.

We also update the set of tests to ensure that we’re properly setting
both the prevHop map and the nextHop map.
2018-01-10 15:15:55 -08:00
Conner Fromknecht c17b695128
lnwallet/btcwallet/blockchain: properly handle nil spend report
This commit adds an additional check in GetUtxo that
tests for the nil-ness of the spend report returned by
the neutrino backend. Previously, a nil error and
spend report could be returned if the rescan did not
find the output at or above the start height. This
was observed to have cause a nil pointer dereference
when the returning line attempted to access the output.
This case is now handled by returning a distinct error
signaling that the output was not found.
2018-01-09 18:14:25 -08:00
Olaoluwa Osuntokun beeb75cb5f
Merge pull request #572 from halseth/fix-flake-announcements
Fix announcements flakes
2018-01-09 15:55:46 -08:00
Olaoluwa Osuntokun e5b74174b5
pilot: avoid cancelling the tx subscription twice, use proper wg value
In this commit we fix a newly introduce bug wherein we would close the
transaction subscription twice on shutdown. This would lead to a
shutdown, but an unclean one as it would panic due to closing a channel
twice.

We fix this my removing a defer statement such that, we’ll only cancel
the subscription once.
2018-01-09 12:19:06 -08:00
Johan T. Halseth 0571918d3d
routing: process only single ChannelEdgePolicy per channelID concurrently
This commit adds synchronization around the processing
of multiple ChannelEdgePolicy updates for the same
channel ID at the same time.

This fixes a bug that could cause the database access
HasChannelEdge to be out of date when the goroutine
came to the point where it was calling UpdateEdgePolicy.
This happened because a second goroutine would have
called UpdateEdgePolicy in the meantime.

This bug was quite benign, as if this happened at
runtime, we would eventually get the ChannelEdgePolicy
we had lost again, either from a peer sending it to
us, or if we would fail a payment since we were using
outdated information. However, it would cause some of
the tests to flake, since losing routing information
made payments we expected to go through fail if this
happened.

This is fixed by introducing a new mutex type, that
when locking and unlocking takes an additional
(id uint64) parameter, keeping an internal map
tracking what ID's are currently locked and the
count of goroutines waiting for the mutex. This
ensure we can still process updates concurrently,
only avoiding updates with the same channel ID from
being run concurrently.
2018-01-09 13:09:29 +01:00
Johan T. Halseth 3f0a525331
discovery test: update gossiper test to account for timestamp deduping 2018-01-09 13:09:28 +01:00