Commit Graph

3644 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
2b00e01c53
Merge pull request #930 from halseth/breacharbiter-broadcast-loop
breacharbiter: reuse spend events instead of re-registering
2018-03-27 15:39:16 -07:00
Olaoluwa Osuntokun
6103ccb081
lnwallet: ensure we only accept/produce sane commitments
In this commit, we add an additional check within CreateCommitTx to
ensure that we will never create or accept a commitment transaction that
wasn't valid by consensus. To enforce this check, we use the
blockchain.CheckTransactionSanity method.
2018-03-27 15:37:15 -07:00
Olaoluwa Osuntokun
b49d29c2b0
Merge pull request #943 from Roasbeef/btc-rounding-fix
lnwallet: use btcutil.NewAmount for BTC -> SAT conversions
2018-03-26 16:00:25 -07:00
François
9997014420 config: invoice macaroon path fix 2018-03-25 19:28:47 -07:00
Olaoluwa Osuntokun
4253b85309
test: ensure tests convert from BTC to SAT properly
This commit is a follow up to the prior commit which fixed a rounding
error bug in lnwallet. For uniformity, we also fix other occurrences in
the breach arbiter, as well as the integration tests.
2018-03-25 19:17:01 -07:00
Olaoluwa Osuntokun
af4afdb6f0
lnwallet: use btcutil.NewAmount for BTC -> SAT conversions
In this commit, we fix an existing rounding related bug in the codebase.
The RPC interface for btcd and bitcoind return values in BTC rather than
in satoshis. So in several places, we're forced to convert ourselves
manually. The existing logic attempted to do this, but didn't properly
account for rounding. As a result, our values can be off due to not
rounding incorrectly.

The fix for this is easy: simply properly use btcutil.NewAmount
everywhere which does rounding properly.

Fixes #939.
2018-03-25 19:15:18 -07:00
Olaoluwa Osuntokun
23b3eaf548
build: update lightning-onion commit hash
In this commit, we update the version of lightning-onion that we pin
against to point to a version that has recently had a nil pointer panic
bug fix.
2018-03-25 18:38:33 -07:00
Olaoluwa Osuntokun
18e6705d97
config: fix linter error (gofmt -s) 2018-03-23 19:26:43 -07:00
Olaoluwa Osuntokun
c653b62832
build: update dep to latest zmq version with reconnection
In this commit, we update our set of dependencies to a new version of
our zmq lib that implements automatic reconnection. With this change,
bitcoind users will have a more robust experience, as if the connection
is dropped, we'll reconnect automatically.

Fixes #875.

Fixes #871.

Fixes #857.
2018-03-23 18:58:12 -07:00
Olaoluwa Osuntokun
ead55783c7
Merge pull request #916 from PWKad/master
Fix error labels when missing LTC configuration
2018-03-23 18:45:47 -07:00
Olaoluwa Osuntokun
69274ecaa4
Merge pull request #923 from brndnmtthws/master
config: Fix formatting, missing param check.
2018-03-23 18:42:26 -07:00
Brenden Matthews
8a51043462
config: Fix formatting, missing param check.
Fixed formatting for autopilot config params, as well as added check for
`MaxChannels` param which was presumably a mistaken copypaste from the
`MaxChannelSize' param.
2018-03-23 21:11:45 -04:00
Olaoluwa Osuntokun
e1b8b1d84f
Merge pull request #926 from Roasbeef/route-around-height-disagreements
routing: route around height disagreements during htlc routing attempts
2018-03-23 17:59:30 -07:00
Olaoluwa Osuntokun
1a05b48080
routing: add new test case to ensure we route around time lock failures 2018-03-23 17:55:16 -07:00
Olaoluwa Osuntokun
62b8ddb839
routing: update TestAddEdgeUnknownVertexes due to additional node in test graph 2018-03-23 17:55:15 -07:00
Olaoluwa Osuntokun
d5721165de
routing: fix TestPathInsufficientCapacity to actually send 1 BTC 2018-03-23 17:55:15 -07:00
Olaoluwa Osuntokun
de1150b78b
routing: add new vertex and to new channels to basic_graph.json
In this commit, we add a new node to the current default test graph
that we use for our path finding tests. This new node connects roasbeef
to sophon via a new route with very high fees. With this new node and
the two channels it adds, we can properly test that we’ll route around
failures that we run into during payment routing.
2018-03-23 17:55:15 -07:00
Olaoluwa Osuntokun
1365392d2b
routing: don't traverse links that advertise a timelock delta of zero 2018-03-23 17:55:14 -07:00
Olaoluwa Osuntokun
f935bd0baf
routing: add vertex pruning for non-final CLTV related errors
In this commit, we add vertex pruning for any non-final CLTV error.
Before this commit, we assumed that any source of this error was due to
the local node setting the incorrect time lock. However, it’s been
recently noticed on main net that there’re a set of nodes that seem to
not be properly scanned to the chain. Without this patch, users aren’t
able to route successfully as atm, we’ll stop all path finding attempts
if we encounter this.
2018-03-23 17:55:14 -07:00
Olaoluwa Osuntokun
2326d4afeb
discovery: bump rejected edges up to the trace logging level 2018-03-23 15:50:56 -07:00
Olaoluwa Osuntokun
635780858e
routing: add rejected spent outputs to the reject cache 2018-03-23 15:50:27 -07:00
Olaoluwa Osuntokun
e7d66e1dfd
peer: don't d/c peer if we encounter lnwire.ErrUnknownAddrType
In this commit, we fix a minor deviation in our implementation from the
specification. Before if we encountered an unknown error type, we would
disconnect the peer. Instead, we’ll now just continue along parsing the
remainder of the messages. This was flared up recently by some
c-lightning related incompatibilities that emerged on main net.
2018-03-23 15:49:33 -07:00
Olaoluwa Osuntokun
00240c6221
lnwire: add new ErrUnknownAddrType for unknown addr types during parsing 2018-03-23 15:46:11 -07:00
Johan T. Halseth
2fa2b545fc
breacharbiter: reuse spend events instead of re-registering
This commit fixes a broadcast loop within the breach arbiter, that would
occur when HTLC outputs had been taken to the second level. The breach
arbiter would register for a spend event, but would immediately go on to
create and publish the justice, without waiting for the response to be
received on the spend channel. This lead to a race, where the outpoint
could actually already have been spent, but the notification would
arrive after the breach arbiter checked the channel, and publishing the
justice TX would fail because it was a double spend. This would create a
"broadcast loop", as seen in the logs from the integration test
revoked_uncooperative_close_retribution_remote_hodl.

This is fixed by reusing an existing spend event for the outputs,
meaning we will actually receive on the first channel we initiated,
making the broadcast loop more likely to terminate.
2018-03-23 13:36:57 +01:00
Olaoluwa Osuntokun
daf542cf89
Merge pull request #920 from halseth/dustlimit-remote-fix
HTLC number mismatch fixes
2018-03-22 17:55:03 -07:00
Patrick Walters
484b12c0f3 config: return proper daemon name for config errors
Fix #915 by capturing the current daemonName and using that in
error messages.
2018-03-22 18:05:14 -05:00
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