Commit Graph

4304 Commits

Author SHA1 Message Date
f26ec38a74 channeldb: return ErrNoPendingCommit in case of no channel bucket 2018-05-08 13:41:52 +02:00
9324bf7b1d lnwallet/channel: return error in case of htlc index mismatch
This commit make us return an error in case a restored HTLC from a
pending remote commit has an index that is different from our local
update log index. It is appended with the assumption that these indexes
are the same, and if they are not we cannot really continue.
2018-05-08 13:41:52 +02:00
7e1f2a7dc3 lnwallet/channel: remove unused arguments 2018-05-08 13:41:52 +02:00
aa1c2cdf81 lnwallet/channel: add more info in case of crash
This commit adds a call to panic in case the HTLC we are looking for is
not found in the update log. It _should_ always be there, but we have
seen crashes resulting from it not being found. Since it will crash with
a nil pointer dereference below, we instead call panic giving us a bit
more information to work with.
2018-05-08 13:41:52 +02:00
1d676b77e1 lnwallet/channel: log pending remote commit during restore 2018-05-08 13:41:51 +02:00
1d172428c4 lnwallet/channel: return missing errors
This commit corrects a few cases where we would encounter errors, but
return nil by mistake.
2018-05-08 13:41:51 +02:00
27ca61aedf Merge pull request #1196 from guggero/contribution-guideline
docs: add line wrap to contribution checklist
2018-05-07 21:37:44 -07:00
4a639fab14 Merge pull request #1193 from guggero/lncli-double-unlock
lncli: improve error message for unlock commands
2018-05-07 21:37:11 -07:00
d2a6c4eec9 htlcswitch: typo fix 2018-05-07 21:33:32 -07:00
a126c91745 docs/INSTALL: add advice for using 127.0.0.1 for bitcoind backend on Windows (#1195)
Using localhost to connect lnd to bitcoind on Windows is very slow.  Use 127.0.0.1 instead.
2018-05-07 21:29:20 -07:00
45ccace41c docs: add line wrap to contribution checklist 2018-05-07 19:21:03 +03:00
8ce73b3f74 lncli: improve error message for unlock commands 2018-05-07 18:44:03 +03:00
bdf3f4d775 Merge pull request #1158 from Roasbeef/play-all-commits
contractcourt+lnwallet: ensure the chainWatcher properly plays all remote commitments
2018-05-04 12:22:02 -07:00
7af699f3a7 contractcourt: update chain watcher tests to latest API 2018-05-03 21:29:30 -07:00
a3227ba147 contractcourt: add two new tests to ensure the chainWatcher is able to play all remote commitments 2018-05-03 21:29:29 -07:00
c8b15719f2 contractcourt: ensure the chainWatcher is able to play all remote commitments 2018-05-03 21:29:29 -07:00
88ff2af931 lnwallet: add new test to exercise creation of unilateral close summaries for pending broadcast commitments 2018-05-03 21:29:29 -07:00
8b06817482 lnwallet: modify NewUnilateralCloseSummary to be aware of pending remote commits
In this commit, we modify the NewUnilateralCloseSummary to be able to
distinguish between a unilateral closure using the lowest+highest
commitment the remote party possesses. Before this commit, if the remote
party broadcast their highest commitment, when they have a lower
unrevoked commitment, then this function would fail to find the proper
output, leaving funds on the chain.

To fix this, it's now the duty of the caller to pass remotePendingCommit
with the proper value. The caller should use the lowest unrevoked
commitment, and the height hint of the broadcast commitment to discern
if this is a pending commitment or not.
2018-05-03 21:29:28 -07:00
90bbc4f41b lnwallet: move CreateTestChannels to new test_utils.go
In this commit, we move a set of useful functions for testing channels
into a new file. The old createTestChannels has been improved as it will
now properly set the height hint on the first created commitments, and
also no longer accepts any arguments as the revocation window no longer
exists.
2018-05-03 21:29:28 -07:00
1ec5dc3c2d channeldb: additionally store static channel information in CloseChannelSummary
In this commit, we extend the CloseChannelSummary by also storing: the
current unrevoked revocation for the remote party, the next pending
unused revocation, and also the local channel config. We move to store
these as the provide an extra level of defense against bugs as we'll
always store information required to derive keys for any current and
prior states.
2018-05-03 21:29:23 -07:00
9017d18f14 Merge pull request #1178 from Roasbeef/travis-htlc-block-race-fix
test: attempt to account for internal block race in htlc force close …
2018-05-03 21:08:52 -07:00
d50247304b test: fix flake in testInvoiceRoutingHints by using WaitPredicate 2018-05-03 21:07:11 -07:00
8712ab110d test: fix revocation integration test flake
In this commit, we fix an existing flake within the set of revocation
integration tests. Right after Bob's restart, we attempt to force close
the channel. However, it may be the case that the chain arbitrator
hasn't yet been created. As a result, the request to force close the
channel will fail. We easily fix this by wrapping the force close
attempt in a WaitPredicate.
2018-05-03 20:50:04 -07:00
e54f1ea4db test: account for block race by mining additional block in remote htlc force close test
This commit is similar to a recent commit which attempts to account for
internal block races by mining a second block if the initial assertion
for HTLC state fails. This can happen again if by the time that the
sweeping transaction is broadcast, it doesn't make it into the next
block mine.
2018-05-03 20:12:46 -07:00
1e7f2c32e9 test: attempt to account for internal block race in htlc force close test
In this commit, we modify the
testMultHopRemoteForceCloseOnChainHtlcTimeout test slightly to attempt
to account for a block race between the arrival of a message betwen the
contract resolver and the utxo nursery. If this message arrives "late"
(relative to the speed with which we mine blocks in test), then it'll be
detected as such by the utxo nursery. However, since we attempt to mine
a precise number of blocks, if this happens, then we'll never actually
mine that extra block to trigger a broadcast of the sweep transaction.
2018-05-03 20:12:46 -07:00
ddd12eff9c htlcswitch: move link trimming to link start up
In this commit, we fix a race in the set of TestChannelLinkTrimCircuits*
tests. Before this commit, we would trim the circuits in the htlcManager
goroutine. However, this was problematic as the scheduling order of
goroutines isn't predictable. Instead, we'll now trim the circuits in
the Start method.

Additionally, we fix a series of off-by-2 bugs in the tests themselves.
2018-05-03 20:11:52 -07:00
d72f28839d Merge pull request #1104 from halseth/chainwatcher-handoff-race
Fix chainwatcher handoff race
2018-05-03 17:18:31 -07:00
ecfde2e85f Merge pull request #1149 from cfromknecht/trim-pending-htlc-index
Trim Open Circuits Using HTLC Index of Pending Commitments
2018-05-03 16:45:29 -07:00
dd60e9e720 docs: spell out go commands in case user doesn't have make
Fixes #1171.
2018-05-03 16:27:09 -07:00
5f059e74cb peer: ensure msgConsumer sets the shutdown variable on exit
In this commit, we fix a bug that could at times cause a deadlock when a
peer is attempting to disconnect. The issue was that when a peer goes to
disconnect, it needs to stop any active msgStream instances. The Stop()
method of the msgStream would block until an atomic variable was set to
indicate that the stream had fully exited. However, in the case that we
disconnected lower in the msgConsumer loop, we would never set the
streamShutdown variable, meaning that msgStream.Stop() would never
unblock.

The fix for this is simple: set the streamShutdown variable within the
quit case of the second select statement in the msgConsumer goroutine.
2018-05-03 15:45:22 -07:00
f7c5a7a19e routing/chainview/neutrino: error if we get a nil cfilter back (#1176) 2018-05-03 15:21:56 -07:00
a4b2765f83 Merge pull request #1165 from guggero/lncli-categories
lncli: group commands into categories
2018-05-03 15:20:50 -07:00
80852601db lncli: group startup commands, make full sentences 2018-05-03 11:49:09 +03:00
42a9a78180 htlcswitch/link: trim fix 2018-05-02 01:12:18 -07:00
ed4f77871a htlcswitch/circuit_map: trim using NextLocalHtlcIndex 2018-05-02 01:12:17 -07:00
cae1d468e7 lnwallet/channel: expose NextLocalHtlcIndex 2018-05-02 01:12:17 -07:00
1b6101b0c0 channeldb/channel: add NextLocalHtlcIndex 2018-05-02 01:12:17 -07:00
308ad1caf6 htlcswitch/link_test: add link trimming tests 2018-05-02 01:12:17 -07:00
56e65339e0 multi: Complete upgrade to new sphinx package interface. 2018-05-02 00:22:25 -07:00
5d0d7a8511 htlcswitch: Move DecayedLog definition from sphinx package.
This moves over the implementation deleted in
https://github.com/lightningnetwork/lightning-onion/pull/22 to
structure package dependencies better.
2018-05-02 00:22:24 -07:00
58c422beb5 dep: Upgrade version of lightning-onion. 2018-05-02 00:21:19 -07:00
9c178f3d7f htlcswitch/link_test: use hodl ExitSettle instead of HodlHTLC 2018-05-02 00:21:09 -07:00
57245b5784 lnd_test: convert hodlhtlc -> hodl.exit_settle 2018-05-02 00:21:08 -07:00
6fa7b2f8f7 lntest/node: execute lnd-debug binary 2018-05-02 00:18:51 -07:00
701d37725c peer: extract hodl mask, remove htlchodl mode 2018-05-02 00:18:51 -07:00
ab607a7ec6 config: hodl config 2018-05-02 00:18:51 -07:00
a36e1e6278 htlcswitch/link: adds HodlFlag breakpoints
This commit inserts an initial set of HodlFlags into
their correct places within the switch. In lieu of the
existing HtlcHodl mode, it is been replaced with a
configurable HodlMask, which is a bitvector representing
the desired breakpoints. This will allow for fine grained
testing of the switch's internals, since we can create
arbitrary delays inside a otherwise asynchronous system.
2018-05-02 00:18:51 -07:00
da53b35c73 make/testing_flags: compiles tests with debug flag 2018-05-02 00:18:51 -07:00
ffd240e0ee Makefile: build debug binaries with build directive 2018-05-02 00:18:50 -07:00
137ec37450 htlcswitch/hodl_mask_test: tests HodlMask active flags 2018-05-02 00:18:50 -07:00