Commit Graph

4086 Commits

Author SHA1 Message Date
d2d87758f7 contractcourt/channel_arbitrator: only act on close signal from chain_watcher
This commit changes the channel arbitrator state machine to only care
about commitment transactions that are being confirmed on-chain
according to the chain_watcher. This is meant to handles the cases where
we would broadcast our commitment, expecting it to get confirmed, but
instead a competing transaction was confirmed.

This commit readies the ChannelArbitrator state machine for the change
that will make the ChainWatcher only notify on confirmed commitments.

The state machine has gotten a new state, StateCommitmentBroadcasted,
which we'll transition to after we have broadcasted our own commitment.
From this state we'll go to the StateContractClosed state regardless of
which commitment the ChainWatcher notifies about, unifying the contract
resolution betweee the local and remote force close.
2018-04-25 09:37:23 +02:00
a60e621b5f contractcourt/channel_arbitrator: specify that height is triggerHeight, advance from height of event not current height 2018-04-25 09:37:23 +02:00
634e23720e breacharbiter_test: use RemoteUnilateralCloseSummary and LocalForceCloseSummary 2018-04-25 09:37:23 +02:00
40b8cf0adb contractcourt/channel_arbitrator: rename UnilateralClose -> RemoteUnilateralClose 2018-04-25 09:37:22 +02:00
bc6b8a7eeb htlcswitch/link: rename UnilateralClose -> RemoteUnilateralClose 2018-04-25 09:37:22 +02:00
2fdc5992a4 breacharbiter: rename UnilateralClose -> RemoteUnilateralClose
Also ensure we exit on LocalUnilateralClose.
2018-04-25 09:37:22 +02:00
49f4a70e5a contractcourt/chain_watcher: add dispatchLocalForceClose
This commit adds a new method dispatchLocalClose, which will be called
in case our commitment is detected to spend the funding transaction. In
this case LocalUnilateralCloseInfo will be sent on the
LocalUnilateralClosure channel to all subscribers.

The UnilateralClosure channel is renamed to RemoteUnilateralClosure for
consistency.
2018-04-25 09:37:22 +02:00
7bacdd65dc contractcourt: define StateCommitmentBroadcasted 2018-04-25 09:37:22 +02:00
3d0cb16677 lnwallet/channel: clearify that the spendDetails is spending funding outpoint 2018-04-25 09:37:22 +02:00
24e8bace9c contractcourt/channel_arbitrator: add missing return after forceClose request 2018-04-25 09:37:21 +02:00
0b2e6d1776 contractcourt/channel_arbitrator: removed unused bestHash parameter 2018-04-25 09:37:21 +02:00
9b9fada675 contractcourt: remove unecessary contractRes check
This commit removes a short circuit checking if the contract resolver
after a unilateral close is empty. After removing this, the state
machine will advance the state from StateDefault->ContractClosed, in
which the stateCallback will be called, logging the state needed to
advance. Since this logged state is empty, the state machine will go
directly to StateFullyResolved, which will trigger the
MarkChannelResolved call. This means the behaviour is kept.
2018-04-25 09:37:21 +02:00
3347431923 lntest/harness: handle predicate error 2018-04-25 09:37:21 +02:00
91edf5ea07 Merge pull request #1121 from Roasbeef/mission-control-less-vertex-pruning
routing: stop pruning edges in response to FailUnknownNextPeer
2018-04-24 18:43:15 -07:00
76b9501e04 routing: update TestSendPaymentErrorPathPruning due to recent UnknownPeer change
In this commit, we update the TestSendPaymentErrorPathPruning test to
reflect the new behavior w.r.t how we respond to UnknownPeer errors. In
this new test, we expect that we'll find alternative route in light of
us getting an UnknownPeer error "pointing" to our destination node.
2018-04-23 17:53:46 -07:00
bd9f1b597e routing: prune edges instead of vertexes in response to an FailUnknownNextPeer error
In this commit we fix an lingering bug in the Mission Control logic we
execute in response to the FailUnknownNextPeer error. Historically, we
would treat this as the _next_ node not being online. As a result, we
would then prune away the vertex from the current reachable graph all
together. It was recently realized, that this would at times be a bit
_tooo_ aggressive if the channel we attempt to route over was faulty,
down, or the incoming node had connectivity issues with the outgoing
node.

In light of this realization, we'll now instead only prune the _edge_
that we attempted to route over. This ensures that we'll continue to
explore the possible edges. Additionally, this guards us against failure
modes where nodes report FailUnknownNextPeer to other nodes in an
attempt to more closely control our retry logic.

This change is a stop gap on the path to a more intelligent set of
autopilot heuristics.

Fixes #1114.
2018-04-23 17:51:02 -07:00
8af80bfc5c Merge pull request #1115 from wpaulino/addinvoice-link-panic
rpcserver: add missing continue if link wasn't retrieved from the switch
2018-04-21 17:57:59 -07:00
f3653339e1 lnd_test: add test for including routing hints in an invoice 2018-04-21 11:37:38 -04:00
a34b2d7de2 rpcserver: add missing continue if link wasn't retrieved
In this commit, we avoid hitting a possible panic in the case that we
were unable to retrieve the link of a channel from the HTLC switch while
determining which channels should be used as routing hints for an
invoice.
2018-04-21 11:31:50 -04:00
435e68a438 Merge pull request #846 from wpaulino/private-channel-routing
multi: support multi-hop payments over private channels
2018-04-20 17:27:12 -07:00
cb8bdc2d21 lnd_test: add test for multi-hop payments over private channels 2018-04-20 19:45:03 -04:00
8469fddb33 lnd_test: modify openChannelAndAssert to open private or public channels 2018-04-20 19:45:02 -04:00
4e90691bf3 rpcserver: include routing hints when sending payments 2018-04-20 19:45:01 -04:00
d1a717ba88 rpcserver: add ability to populate routing hints when creating an invoice 2018-04-20 19:45:00 -04:00
ff2be77c00 cmd/lncli: add private flag to addinvoice command 2018-04-20 19:17:19 -04:00
1713394eb3 lnrpc: add private field to addinvoice request
In this commit, we add a `private` field to the `AddInvoice` RPC's
request to denote whether the invoice being created should include
routing hints for private channels to assist the payer in reaching the
destination.
2018-04-20 04:01:37 -04:00
1b137bf14c rpcserver: populate the routing hints of an invoice when decoding it 2018-04-20 04:01:36 -04:00
6394c2fbb5 lnrpc: add route hints proto field to invoices 2018-04-20 04:01:35 -04:00
ea9e609ef0 zpay32: modify an invoice's r field to allow multiple routes
Before this commit, if an invoice encoded multiple `r` fields, we would
decode them as one single route. We fix this by allowing an invoice to
store multiple routes.
2018-04-20 04:01:34 -04:00
beb08b3887 routing: add test for finding paths with additional edges 2018-04-20 04:01:33 -04:00
4598df054e routing: modify findPath to take into account additional edges
In this commit, we modify our path finding algorithm to take an
additional set of edges that are currently not known to us that are
used to temporarily extend our graph with during a payment session.
These edges should assist the sender of a payment in successfully
constructing a path to the destination.

These edges should usually represent private channels, as they are not
publicly advertised to the network for routing.
2018-04-20 04:01:32 -04:00
7965247db1 routing: add additionalEdges field to a missionControl's paymentSession
In this commit, we introduce the ability for payment sessions to store
an additional set of edges that can be used to assist a payment in
successfully reaching its destination.
2018-04-20 04:01:31 -04:00
5ddee85479 routing: prevent logging the public key params within the routing hints 2018-04-20 04:01:30 -04:00
1e5659e5f4 routing: introduce routing hints to lightning payments
In this commit, we add a new field of routing hints to payments over the
Lightning Network. These routing hints can later be used within the path
finding algorithm in order to craft a path that will reach the
destination succesfully.
2018-04-20 04:01:29 -04:00
c8abeb46a5 docs: add symlink for go suggestion to INSTALL.md 2018-04-19 16:06:39 -07:00
e2229b74e7 Merge pull request #1081 from t4sk/queryroutes-return-msat
Include millisatoshis in queryroutes
2018-04-18 19:33:43 -07:00
431f3f3185 build: update to latest btcwallet commit
In this commit we update to the latest version of btcwallet which will
properly detect bitcoind rejections when attempting to retransmit
unmnined transaction on restart. Additionally, we'll now remove any
transaction that are rejected from the mempool at broadcast time.

Related to #1030.
2018-04-18 19:01:25 -07:00
eb80d07b26 tests: add integration tests for queryroutes 2018-04-19 09:15:21 +08:00
49510d775f rpcserver: include millisatoshis in marshallRoute 2018-04-19 09:15:21 +08:00
31feeca51a lnrpc: extend Route to include millisatoshis 2018-04-19 09:15:21 +08:00
eab87140e9 lncli: make locating funding_txids easier 2018-04-18 12:38:25 -07:00
c6499f095a zpay32: improve "wrong network" error message 2018-04-18 12:37:28 -07:00
938d367232 server: change PeerNotFound to PeerNotConnected 2018-04-18 12:34:57 -07:00
005510b54f chainntnfs/bitcoindnotify: fix possible panic with lack of txindex
In this commit, we fix a recently introduced bug which can result in a
panic when bitcoind nodes without a txindex active are started. The
issue was that we would still defence the transaction's blockhash, which
would be nil if we detected that the backend didn't have the txindex
active.
2018-04-17 20:08:58 -07:00
188b8462cd lnwallet: update addr in transactions_test.go for new regtest hrp 2018-04-17 19:26:32 -07:00
d63b923f5e Revert "rpcserver: remove uneccessary signal to breacharbiter at force close"
This reverts commit 0f90c950da.

We actually still need to notify the BRAR of a force close, as
otherwise, it doesn't have a signal to exit due to a local force close
event.
2018-04-17 19:05:40 -07:00
4009f7f874 multi: fix typos in comments 2018-04-17 19:03:27 -07:00
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
0720e83840 main: Stop setting GOMAXPROCS to NumCPU explicitly (#1096)
GOMAXPROCS will be set automatically after Go 1.5. The minimum version
supported at the moment is 1.9, so setting GOMAXPROCS to NumCPU is not
necessary anymore.

References
https://docs.google.com/document/d/1At2Ls5_fhJQ59kDK2DFVhFu3g5mATSXqqV5QrxinasI/edit
https://tip.golang.org/doc/go1.5#introduction
2018-04-17 18:59:23 -07:00
7a50097dec docs: update Go version to 1.9 in Contribution Checklist (#1095)
According to install.md, the minimum version of Go supported at the 
moment is 1.9, so update the Go version referenced in Contribution 
Checklist to 1.9 as well.
2018-04-17 18:58:46 -07:00