Commit Graph

2895 Commits

Author SHA1 Message Date
Sam Lewis
b3509d491a chainntnfs: Add chainntfs lazy consumer test
This test adds a test for a consumer that registers for a transaction
confirmation but takes some time to check if that confirmation has
occured.

The test reveals a race condition that can cause btcdnotify to add a
confirmation entry to its internal heap twice. If the notification
consumer is not prompt in reading from the confirmation channel, this
can cause the notifier to block indefinitely.
2017-11-13 22:36:25 -08:00
Jim Posen
78f8ddef72 lnd: Remove some sleeps in integration tests.
There is a sleep after channels are opened to ensure the channel is
removed from the set of pending reservations. We can avoid this sleep
and get better guarantees of the channel being opened by deleting the
reservation just before updating channel state to active instead of
after.
2017-11-13 20:52:07 -08:00
Jim Posen
c501da3a95 lnd: Context timeouts on SendPayment RPC request in tests.
This helps catch issues in the RPC tests faster by putting a timeout
on all SendPayment requests. Otherwise, if a payment stalled, the test
would run until the test suite timeout, 10 minutes. Also simplifies
some code with a helper function and using SendPaymentSync where
possible.
2017-11-13 20:52:07 -08:00
Jim Posen
7d65ad4302 lnd: Ensure networkWatcher goroutine exits when harness is stopped. 2017-11-13 20:52:07 -08:00
Jim Posen
923dd9ac30 lnd: Better error handling in lightningNode.Start().
There is an issue currently where if an error occurs in Start() before
the LightningClient is initialized, the process won't be killed and
the program will segfault (because Stop() tries to call a method on
the nil LightningClient). This handles some of those edge cases.
2017-11-13 20:52:07 -08:00
Jim Posen
643c23f978 lnd: Improve error handling for node failures in integration tests.
If an lnd node encounters a fatal process errors, we now log the error
asynchronously, instead of calling Fatalf on the test instance. This
is because calling Fatalf in a separate goroutine does not actually
end the test immediately as expected, but rather just kills the
goroutine. This ensures that we see server errors on all nodes before
the test process exits.
2017-11-13 20:52:07 -08:00
Steven Roose
4e615f9afb lnd: add sample config file 2017-11-11 18:58:06 -08:00
Olaoluwa Osuntokun
b7407cf99b
Merge pull request #399 from halseth/encrypted-wallet-helptext
lncli: Print help text in case of encrypted wallet.
2017-11-11 18:54:00 -08:00
Olaoluwa Osuntokun
e7e426a1cc
Merge pull request #398 from halseth/sighash-signdesc-hashtype
Use dynamic SigHash type when signing transactions.
2017-11-11 17:30:54 -08:00
Alex
9bc25df906 lnwallet: fix linter complaints re. capitalization in interface test 2017-11-11 17:24:48 -08:00
Alex
7b43c9a750 lnwallet: add timeout and more accurate check to reorg interface test 2017-11-11 17:24:48 -08:00
Olaoluwa Osuntokun
06f82474d4
Merge pull request #407 from cfromknecht/router-prevent-rescan
router: prevent rescan on startup
2017-11-11 17:05:13 -08:00
Olaoluwa Osuntokun
b6f64932c2
htlcswitch: face race condition in unit tests by returning invoice
In this commit we modify the primary InvoiceRegistry interface within
the package to instead return a direct value for LookupInvoice rather
than a pointer. This fixes an existing race condition wherein a caller
could modify or read the value of the returned invoice.
2017-11-11 16:09:29 -08:00
Conner Fromknecht
e62bb0319d
routing/chainview/btcd: makes rescan logging statement print to trace 2017-11-11 15:53:42 -08:00
Conner Fromknecht
153794adb0
routing/router: sets bestHeight before filtering chain
This commit alters the behavior of the router's logic on
 startup, ensuring that the chain view is filtered using
 the router's latest prune height. Before, the chain was
 filtered using the bestHeight variable, which was
 uninitialized, benignly forcing a rescan from genesis.
 In tracking down this, we realized that we should
 actually be using the prune height, as this is
 representative of the channel view loaded from disk.
 The best height/hash are now only used during
 startup to determine if we are out of sync.
2017-11-11 15:53:38 -08:00
Olaoluwa Osuntokun
010815e280
lnwallet: no need to grab mutex in ProcessChanSyncMsg as is init method
In this method we fix an existing deadlock within the unit tests when
running with the race condition detector on. We don’t need to grab the
mutex within the ProcessChanSyncMsg method as this should be the very
first method called when initializing the channel if a channel state
sync is needed.
2017-11-11 15:50:33 -08:00
Olaoluwa Osuntokun
7d10ab3ae8
htlcswitch: increase timeouts of tests due to race condition detector 2017-11-11 15:07:02 -08:00
Olaoluwa Osuntokun
9d6e9c73f1
htlcswitch: modify TestChannelRetransmission to exit on first test failure 2017-11-11 15:06:25 -08:00
Olaoluwa Osuntokun
849abde253
htlcswitch: fix mockInvoiceRegistry implementation of SettleInvoice
In this commit we fix the implementation of SettleInvoice by ensuring
the lock is held for the duration of the method.
2017-11-11 15:05:58 -08:00
Olaoluwa Osuntokun
a702aace9c
htlcswitch: add new concurrentTester wrapper struct
In this commit we add a new wrapper struct for the testing.T struct
that allows multiple clients to attempt to fail a given test at the
same time.
2017-11-11 15:05:15 -08:00
Olaoluwa Osuntokun
861412529d
lnwallet: add select on quit when waiting for job from sigPool
In this commit we ensure that the channel is always able to exit by
adding a select statement with a quit case when we’re waiting on the
result of a job that was previously sent into the sigPool.
2017-11-11 15:00:50 -08:00
Olaoluwa Osuntokun
03ba13fcf8
lnwallet: ensure sigPool goroutines can always exit 2017-11-11 14:59:56 -08:00
Olaoluwa Osuntokun
8c181b6f4e
discovery: return an error if ChannelUpdate has unknown flags
In this commit, we fix an existing bug that could result in a panic if
we received a ChannelUpdate message with an unknown set of flags. If
the flag wasn’t set to zero or one, then the pubKey parameter would be
still nil when we attempted to validate it, causing an error to occur.

We remedy this by instead returning an error if the flags are unknown.
In a future commit, we will properly handle the set of flags that
indicates the channel should be disabled.
2017-11-11 14:59:16 -08:00
Olaoluwa Osuntokun
249e578130
README: add checkbox to BOLT #2 compatibility
Fixes #137!!!

Fixes #380, #297, #194, #137.
2017-11-10 19:51:15 -08:00
Olaoluwa Osuntokun
5a8ebb09f7
test: decrease amount sent in multi-hop error integration test
In this commit, we increase the initial amount sent in the multi-hop
error integration test. We must do this now as the Bandwidth() function
now takes into account the total fee paid within the commitment
transaction. This caused an earlier send to fail instead of the once
following send.

To fix this, we simply send less in the initial test case.
2017-11-10 19:51:14 -08:00
Olaoluwa Osuntokun
4c70135bb8
test: remove testChannelReestablishment integration test
This commit removes the testChannelReestablishment integration test as
it is currently incomplete. In order to properly test this, we require
some infrastructure that allows us to kill the connection at will once
a message is sent across the wire.
2017-11-10 19:51:14 -08:00
Olaoluwa Osuntokun
3f4b1592a3
lnwallet: add logging error message is unable to carry HTLC in state machine 2017-11-10 19:51:13 -08:00
Olaoluwa Osuntokun
632f230fef
htlcswitch: add quit case to initial channel state sync select in channelLink
In this commit we add a quit case to the select statement that’s
entered once a link is created. Before this commit, upon restart it
would be possible that the deamon would never ben able to shutdown as
the link would be waiting for the messages to be sent by the other
side.
2017-11-10 19:51:13 -08:00
Olaoluwa Osuntokun
6f51b941df
multi: fix linter errors 2017-11-10 19:51:13 -08:00
Olaoluwa Osuntokun
1fb05e0436
channeldb: properly craft key for reading/writing channel commitments
In this commit, we fix an existing bug that arose due to incorrectly
crafting the key we use to store channel commitments. Before this
commit, we tried to copy to a slice that hadn’t been allocated yet. As
a result, the key would only have the 0x00 or 0x01 as its value. We fix
this by properly crafting the key using the built-in append function.
2017-11-10 19:51:12 -08:00
Olaoluwa Osuntokun
699e5327e1
channeldb: don't delete the chainHash bucket in CloseChannel
In this commit, we fix an existing bug wherein if we closed two
channels, then we were unable to read the channel state afterwards as
we deleted the enclosing bucket.
2017-11-10 19:51:12 -08:00
Olaoluwa Osuntokun
3875754e0f
channeldb: also update chanInfo when updating commitment
In this commit, we fix an existing bug wherein we failed to update the
channels state once we accepted a new commitment. As a result, after a
state transition, if the channel state was read from disk, values like
TotalMSatSent wouldn’t be properly updated.
2017-11-10 19:51:11 -08:00
Olaoluwa Osuntokun
150ab00842
peer: add message summary for lnwire.ChannelReestablish 2017-11-10 19:51:11 -08:00
Olaoluwa Osuntokun
1d6e5ad1ef
channeldb: add missing mutex interaction to new methods 2017-11-10 19:51:11 -08:00
Olaoluwa Osuntokun
8a69397714
rpcserver: update calls to adhere to new channeldb API's 2017-11-10 19:51:10 -08:00
Olaoluwa Osuntokun
a39825db3f
test: update createTestPeer to adhere to new channeldb API's 2017-11-10 19:51:10 -08:00
Olaoluwa Osuntokun
e337a329cd
peer+rpc: properly set ChainHash in ChannelCloseSummary instances 2017-11-10 19:51:09 -08:00
Olaoluwa Osuntokun
841f4f73cf
breacharbiter: update tests to add chainHash to retributionInfo in test data 2017-11-10 19:51:09 -08:00
Olaoluwa Osuntokun
ce7a981b4f
breacharbiter: add chainhash to retributionInfo struct
In this commit we add a chainhash field to the retributionInfo struct
as within the database, channels are now further namespaced by their
chain hash, and all ChannelCloseSummary structs now also carry the
chain hash of their respective chain.
2017-11-10 19:51:08 -08:00
Olaoluwa Osuntokun
2862b6e6f1
funding: update to adhere to new channels API's 2017-11-10 19:51:08 -08:00
Olaoluwa Osuntokun
431f6fc2c8
htlcswitch: update TestChannelRetransmission to print out expected balance when failure 2017-11-10 19:51:08 -08:00
Olaoluwa Osuntokun
9a6e3b5d9c
htlcswitch: disable extra logging within TestChannelRetransmission 2017-11-10 19:51:07 -08:00
Olaoluwa Osuntokun
5e2b2a5cc8
htlcswitch: move retransmissionTests var into scope of test 2017-11-10 19:51:07 -08:00
Olaoluwa Osuntokun
fceec1306d
htlcswitch: update TestChannelLinkBandwidthConsistencyOverflow to account for HTLC fees 2017-11-10 19:51:06 -08:00
Olaoluwa Osuntokun
3e00b2a0a9
htlcswitch: update TestChannelLinkBandwidthConsistency to account for HTLC fees 2017-11-10 19:51:06 -08:00
Olaoluwa Osuntokun
d7cc3c5015
htlcswitch: account for FundingLocked retransmission in TestChannelLinkSingleHopMessageOrdering 2017-11-10 19:51:05 -08:00
Olaoluwa Osuntokun
0dc98d9955
htlcswitch: fix TestChannelLinkMultiHopInsufficientPayment add additional comment 2017-11-10 19:51:05 -08:00
Olaoluwa Osuntokun
a558925978
htlcswitch: correct godoc comment on TestLinkForwardTimelockPolicyMismatch 2017-11-10 19:51:05 -08:00
Olaoluwa Osuntokun
f39ffd67ef
htlcswitch: update getChanID to be aware of FundingLocked
In this commit, we update getChanID to be aware of the FundingLocked
message as it will be retransmitted upon reconnect if both nodes think
that they’re at the very first commitment state.
2017-11-10 19:51:04 -08:00
Olaoluwa Osuntokun
cb85b2bd26
htlcswitch: update createTestChannel to adhere to latest channeldb API's 2017-11-10 19:51:04 -08:00