Commit Graph

3668 Commits

Author SHA1 Message Date
yohei okada
bd631a43bb docs: Update old link to networkHarness framework (#919) 2018-03-22 12:42:11 -07:00
Johan T. Halseth
a6e7dce7b7
lnwallet/channel: reject received commitment with too many htlc sigs
This commit adds a check that will make LightningChannel reject a
received commitment if it is accompanied with too many HTLC signatures.
This enforces the requirement in BOLT-2, saying:

if num_htlcs is not equal to the number of HTLC outputs in the local commitment transaction:
    * MUST fail the channel.

A test exercising the behaviour is added.
2018-03-22 14:58:22 +01:00
Johan T. Halseth
70b86e596e
lnwallet/channel: use remote dustlimit when generating HTLC sigs
This commit fixes an issue which would arise in some cases when the
local and remote dust limits would differ, resulting in lnd not
producing the expected number of HTLC signatures. This was a result of
checking dust against the local instead of the remote dust limit.

A test exercising the scenario is added.
2018-03-22 14:58:22 +01:00
Johan T. Halseth
263d6b9c1f
lnwallet/channel: don't accept immediately on empty htlc sigs
This commit fixes an issue where we would blindly accept a commitment
which came without any accompanying HTLC signatures. A test exercising
the scenario is added.
2018-03-22 14:58:22 +01:00
Johan T. Halseth
241c79397f
lnwallet/channel: fix crash on receiving too few HTLC sigs
This commit fixes an out of bounds error that would occur in the case
where we received a new commitment where the accompanying HTLC sigs were
too few. Now we'll just reject such an commitment.

A test exercising the behavior is also added.
2018-03-22 14:58:22 +01:00
Olaoluwa Osuntokun
807b84ee63
Merge pull request #906 from adrienemery/python-docs
docs: add macaroon example to python docs, update syntax to python 3
2018-03-21 17:16:54 -07:00
Olaoluwa Osuntokun
4a3980353d
lntest: update test node arguments to account for new invoice.macaroon 2018-03-21 15:46:51 -07:00
Olaoluwa Osuntokun
7d14ed7a06
Merge pull request #904 from Roasbeef/invoice-macaroon
rpc+lnd: add new invoice-only macaroon
2018-03-21 15:27:31 -07:00
Olaoluwa Osuntokun
90cb2944eb
Merge pull request #893 from Roasbeef/routing-error-handling-bug-fix
routing: add timeout during pay attempts, don't exit if unable apply update, account for all onion errors
2018-03-21 15:24:29 -07:00
Olaoluwa Osuntokun
93b04b39fe
routing: account for remaining routing onion errors in SendPayment
In this commit, we address a number of edge cases that were unaccounted
for when responding to errors that can be sent back due to an HTLC
routing failure. Namely:

   * We’ll no longer stop payment attempts if we’re unable to apply a
channel update, instead, we’ll log the error, prune the channel and
continue.
    * We’ll no remember which channels were pruned due to insufficient
fee errors. If we ever get a repeat fee error from a channel, then we
prune it. This ensure that we don’t get stuck in a loop due to a node
continually advertising the same fees.
   * We also correct an error in which node we’d prune due to a
temporary or permanent node failure. Before this commit, we would prune
the next node, when we should actually be pruning the node that sent us
the error.

Finally, we also add a new test to exercise the fee insufficient error
handling and channel pruning.

Fixes #865.
2018-03-21 15:23:48 -07:00
Olaoluwa Osuntokun
363cec7012
routing: add new PayAttemptTimeout field to LightningPayment
In this commit, we add a new field to the LightningPayment struct:
PayAttemptTimeout. This new field allows the caller to control exactly
how much time should be spent attempting to route a payment to the
destination. The default value we’ll use is 60 seconds, but callers are
able to specify a diff value. Once the timeout has passed, we’ll
abandon th e payment attempt, and return an error back to the original
caller.
2018-03-21 15:23:45 -07:00
Olaoluwa Osuntokun
0155bcfd5c
Merge pull request #881 from Roasbeef/autopilot-target-chan-size
funding+pilot: increase min channel size, allow specifying chan size range for autopilot
2018-03-21 15:11:25 -07:00
Olaoluwa Osuntokun
4c0dcdafa5
config+lnd: introduce new invoice-only macaroon
In this commit, we wrap up the prior ones and introduce config
settings, as well as proper generation for a new invoice-only macaroon.
All prior invoice path rules are also properly enforced of this new
invoice.macaroon.
2018-03-21 15:08:54 -07:00
Olaoluwa Osuntokun
a07579c541
rpc: modify the entity of invoice related RPC's to target the invoice entity
In this commit, we modify the existing invoice RPC macaroon permissions
to target a more specific entity: “invoices”. As a result of this
commit, once node operators update, they’ll need to regenerate their
readonly.macaroon as it now needs this additional entity encoded within
it.
2018-03-21 15:08:54 -07:00
Olaoluwa Osuntokun
6a294e7489
rpc: extend writePermissions and readPermissions with the invoice entity
In the prior commit, we added a new set of permissions and also a new
entity: “invoices”. We’ll add this set of entities to the read and
write permissions accordingly as well to ensure that the existing
macaroons have access to all the items that the invoice.macaroon does.
2018-03-21 15:08:53 -07:00
Olaoluwa Osuntokun
6c6285344b
rpc: add new invoicePermissions bakery.Op slice for an invoice only macaroon
In this commit, we add a new invoicePermissions slice. This contains
all the permission that a holder of an invoice.macaroon is able to
access, and no others. We also include read and write access to
addresses as this may be useful from the PoV of a merchant or exchange.
2018-03-21 15:08:50 -07:00
Adrien Emery
7fe719f77f docs: add correct cipher suit to python grpc example 2018-03-20 17:54:19 -07:00
Jonathan Underwood
237ed4fc6e lnd+config: add TLSExtraDomain to config
Self explanatory.

Needed for NodeJS, as the grpc library only allows TLS connections to domains and not IP addresses.
2018-03-20 15:57:14 -07:00
Olaoluwa Osuntokun
6d07b865d6
Merge pull request #847 from stevenroose/typo-funding
rpc: Fix typo in OpenChannelRequest
2018-03-20 15:55:30 -07:00
Olaoluwa Osuntokun
3d49deb5df
Merge pull request #894 from Roasbeef/peer-stop-channel
peer: ensure we stop the channel if error happens in loadActiveChannels
2018-03-20 15:54:23 -07:00
Adrien Emery
5ef0d4c8b9 docs: update python grpc examples to use python 3 syntax 2018-03-20 13:42:53 -07:00
Adrien Emery
55e882c058 docs: add macaroon usage examples to python docs 2018-03-20 13:38:30 -07:00
Johan T. Halseth
9c0fc023af
Merge pull request #834 from wilmerpaulino/list-channels
multi: specify retrieving active, inactive, public, and private channels from listchannels rpc
2018-03-20 09:37:58 +01:00
Olaoluwa Osuntokun
fda3b871c1
peer: ensure we stop the channel if error happens in loadActiveChannels
In this commit, we fix a goroutine leak that could occur if while we
were loading an error occurred in any of the steps after we created the
channel object, but before it was actually loaded in to the script. If
an error occurs at any step, we ensure that we’ll stop toe channel.
Otherwise, the sigPool goroutines would still be lingering and never be
stopped.
2018-03-19 19:14:55 -07:00
Steven Roose
9516d8da52 rpc: Fix typo in OpenChannelRequest 2018-03-19 19:11:47 +01:00
Wilmer Paulino
900cd43768
multi: change to lnrpc.Channel type due to proto update 2018-03-19 11:19:06 -04:00
Wilmer Paulino
7642bad54f
cmd/lncli: add flags to listchannels to retrieve specific channels 2018-03-19 11:19:05 -04:00
Wilmer Paulino
85b03780f3
rpcserver: determine which channels to return based on passed params 2018-03-19 11:19:04 -04:00
Wilmer Paulino
95997b9c6c
lnrpc: add flags to specify retrieving different channels 2018-03-19 11:19:02 -04:00
Olaoluwa Osuntokun
76f7a66259
config+pilot: add new config params to specify min+max autopilot chan size
In this commit, we add two new configuration parameters to allow users
to specify the min and max size that the autopilot agent will create.
This is useful as now users can set the values to more or less the same
size, which will allow them to control the size of each created
channel.

Before this commit, if this wasn’t set, then the agent would try to
shove as much money into a channel up until the max chan size. This was
nice on testnet, but on main net, users will likely not want all their
funds to be in a single channel, and instead be distributed across many
channels. With things like AMP, have more channels becomes more
desirable.
2018-03-18 17:10:28 -07:00
Olaoluwa Osuntokun
8127685462
funding+rpc: raise min channel size to 20k satoshis
In this commit, we raise the min channel size to 20k satoshis. This
will be evaluated before we check for dusty commitments. The goal of
this is to ensure ample room for fees at current, and future fee
levels.
2018-03-18 17:10:25 -07:00
Matt Drollette
92eebff64e macaroons: don't zero mem if never unlocked 2018-03-18 16:09:54 -07:00
Alex Gessner
0c1b619e53 docs: move defaultchanconfs setting in sample-lnd.conf to bitcoin section
Since https://github.com/lightningnetwork/lnd/pull/506, `defaultchanconfs` is nested under `bitcoin`. Using this parameter at the top level generates a warning message:
```
2018-03-17 23:07:08.273 [WRN] LTND: /home/bitcoin/.lnd/lnd.conf:7: unknown option: defaultchanconfs
```
and using it nested under `bitcoin` does not.
2018-03-18 16:09:22 -07:00
Olaoluwa Osuntokun
ce85632390
discovery: ensure target host for DNS fallback is fully qualified
In this commit, fix the inability of some users to connect to the DNS
seed using our direct TCP fallback. We do this as some resolvers filter
out our large SRV requests due to their size (they also include public
keys). Instead, we’ll use a direct TCP resolution in this case.
However, after a recent change, we forgot the period at the end of the
target DNS host. This is an issue as the domain needs to be fully
qualified.

The fix is easy, add a period within our string formatting to target
the proper sub-domain and SRV target.

Fixes #854.
2018-03-18 16:05:10 -07:00
Andreas M. Antonopoulos
47329c9267 docs: inconsistent ZMQ port numbers in examples
The port numbers used in the ZMQ examples are inconsistent between:

- The initial explanation of ZMQ
```
They must be combined in the same ZMQ socket
  address (e.g. `--zmqpubrawblock=tcp://127.0.0.1:28332` and
  `--zmqpubrawtx=tcp://127.0.0.1:28332`).
```

- The sample bitcoin.conf
```
zmqpubrawblock=tcp://127.0.0.1:18501
zmqpubrawtx=tcp://127.0.0.1:18501
```

- The lnd command-line example:
```
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=REPLACEME --bitcoind.rpcpass=REPLACEME --bitcoind.zmqpath=tcp://127.0.0.1:28332 --externalip=X.X.X.X
```

I changed the sample bitcoin.conf port numbers to 28332 so they match the rest of the examples.
2018-03-17 14:37:57 -07:00
João Mesquita
b0c35d5f39 README: fix go bin path in INSTALL.md
FIxes #839.
2018-03-16 16:28:57 -07:00
Perdouille
c33645cc80 README: fixed a small typo on INSTALL.md
`bitciond` => `bitcoind`
2018-03-16 16:28:01 -07:00
Matt Drollette
1b7b35a8bc discovery: format log message with Errorf 2018-03-16 16:25:18 -07:00
bretton
1740c630c6 lnd: update version to have proper pre-release name 2018-03-16 14:42:31 -07:00
Olaoluwa Osuntokun
b866806d67
lnd+cmd/lncli: bump version to 0.4 2018-03-15 06:38:46 -07:00
Olaoluwa Osuntokun
71a5fac9c7
lnd+config: add flags for mainnet 2018-03-15 06:38:45 -07:00
Olaoluwa Osuntokun
c00880144c
chains: modify applyLitecoinParams to take target LTC params 2018-03-15 06:38:45 -07:00
Olaoluwa Osuntokun
3bf6626f73
chains: add net params for TBC and LTC main net 2018-03-15 06:38:41 -07:00
Olaoluwa Osuntokun
8f4a8fcf57
chains: add DNS seeds for mainnet BTC and LTC 2018-03-15 02:00:19 -07:00
Olaoluwa Osuntokun
68f842d90b
chains: add genesis hashes for BTC and LTC mainnet 2018-03-15 01:58:35 -07:00
Olaoluwa Osuntokun
9aac0c41a2
test: update nursery_store_test.go due to recent chain genesis renaming 2018-03-14 19:11:16 -07:00
Olaoluwa Osuntokun
30019538c4
discovery: update DNS bootstrapper to adhere to new query schema
In this commit, we update the DNS bootstrapper to match the new query
semantics expected by the new DNS server. We no longer hard code the
target DNS host, and instead, we’ll re-use the same target endpoint as
we only need the soaShim in order to establish a direct TCP connection
for the queries.
2018-03-14 18:27:29 -07:00
Olaoluwa Osuntokun
6793f3653e
chains: rename liteTestNetParams to litecoinTestNetParams 2018-03-14 18:27:29 -07:00
Olaoluwa Osuntokun
9ec80e2083
server: properly segment the nursery store according to active net 2018-03-14 18:27:28 -07:00
Olaoluwa Osuntokun
620b552413
chains: switch to new DNS seed for bitcoin testnet
In this commit we switch over to the new DNS seed for Bitcoin’s
testnet. This seed will only serve active nodes that are found on
Bitcoin’s testnet.
2018-03-14 18:27:24 -07:00