Commit Graph

3361 Commits

Author SHA1 Message Date
Wilmer Paulino
07ac278771
invoice: properly parse the field data length
When accessing a value from a byte slice, the value is returned as a
byte, which is just a uint8. When the first byte takes more than 3 bits
of space, shifting 5 bits left results in data loss.
2018-01-19 10:52:24 -05:00
Wilmer Paulino
fa2cc57ca6
invoice: sanity check routing info field
This commit allows parseRoutingInfo to return an error when parsing a
routing info field whose length is not a multiple of 51 bytes, rather
than crash.
2018-01-19 10:52:23 -05:00
Wilmer Paulino
db7154a401
invoice: sanity check empty fallback addr field
This commit allows parseFallbackAddr to return an error when parsing an
empty fallback address field, rather than crash.
2018-01-19 10:52:22 -05:00
Wilmer Paulino
00d530bd91
invoice: remove duplicate code when parsing the timestamp 2018-01-19 10:52:21 -05:00
Wilmer Paulino
6f5d673679
invoice: refactor parsing tagged fields
This commit refactors parsing each of the tagged fields of an invoice
into their own method. This makes the code easier to read and will allow
us to introduce unit tests for each parsing method.
2018-01-19 10:52:21 -05:00
Johan T. Halseth
cb7699068b
Merge pull request #591 from AdamISZ/master
Fix trivial comment errors in noise.go
2018-01-19 14:47:22 +01:00
Johan T. Halseth
88f5c9ca9c
Merge branch 'master' into master 2018-01-19 14:04:52 +01:00
Deelight-fr
e4e6766746 Doc fix: typo in lnd/bitcoind arguments 2018-01-19 11:23:05 +01:00
Conner Fromknecht
5126e43135
rpcserver: flip inbound bool for display, fix internally later 2018-01-18 14:10:35 -08:00
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