Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun f9f9d68543 test: ensure the WaitForBlockchainSync grouting always exits
This commit fixes a minor bug in the goroutine that’s launched to check
the sync status of a particular node. Previously, the goroutine could
end up infinitely stuck on a send as once the chain has been detected
as synced, it didn't exit.

We fix this now by ensure that the goroutine always terminates after
the initial notification to the caller. Additionally, we not ensure
that both the internal and exterior goroutine are both reading off of
the peer’s quit channel.
2017-07-11 16:29:35 -07:00
Olaoluwa Osuntokun 906771ba16 features: add temporary feature for proper HTLC dust accounting 2017-07-06 18:30:51 -07:00
Olaoluwa Osuntokun 497b522c13 lnd: update logging interaction to latest API changes 2017-07-06 14:37:02 -07:00
Olaoluwa Osuntokun 4c3e24567e build: update new logging related dependancies to latest versions 2017-07-06 14:36:16 -07:00
Olaoluwa Osuntokun 21cb3837c4 test: add synchronization to testDisconnectingTargetPeer 2017-07-06 14:18:04 -07:00
Olaoluwa Osuntokun f39b7aaaf9 build: create parallel travis builds to isolate race condition tests
This commit modifies the travis build script, and our local test script
to ensure that the race condition builds are conducted in a parallel
build. After this commit two travis builds will be kicked off for each
push/commit: one that runs the race condition tests in isolation, and
another that runs the integration tests then the coverage tests.

In order to do the above cleanly, the integration tests are now guarded
behind a build flag. In order to run the integration tests, one now
needs to specify the `-tags rpctest` flag when running the `go test`
command.
2017-07-04 16:05:22 -07:00
Olaoluwa Osuntokun 01d54c29af htlcswitch: restore the ability to properly handle debughtlc recv's
This commit fixes a regression introduce in the prior commit which
added full verification of the per-hop payloads to the ChannelLink
interface. When this was initially implemented, the added checks
weren’t guarded on the existence of debughtlc’s. As a result,
debughtlc’s would be rejected as they don’t match the expected invoice
value.

This commit fixes that issue by only checking the hop payload if debug
HTLC mode isn’t on.
2017-07-04 15:58:23 -07:00
Olaoluwa Osuntokun a824a2a855 cmd/lncli: properly display errors when sending payments 2017-07-04 15:55:34 -07:00
Olaoluwa Osuntokun c5f4049394 chainntnfs: convert ChainNotifier interface tests to use sub-tests 2017-07-04 15:54:45 -07:00
Olaoluwa Osuntokun 9daa659bb3 routing/chainview: convert chainview integration tests to use sub-tests 2017-07-04 15:53:58 -07:00
Olaoluwa Osuntokun 3b1db2b186 test: update integration test set up to reflect recent RPC change
A prior commit modified the walletbalance RPC to return satoshi instead
of BTC. As a result, we need to update the SetUp method in the
networkHarness to ensure we expect the proper value when asserting
wallet balances.
2017-07-04 15:53:06 -07:00
Olaoluwa Osuntokun 7c5af4b851 rpc: properly return satoshis in WalletBalance response 2017-07-04 15:51:08 -07:00
Olaoluwa Osuntokun 58d3fd9dd8 lnrpc: WalletBalance now returns satoshis instead o fBTC 2017-07-04 15:50:33 -07:00
Olaoluwa Osuntokun 9b9f419e51 routing: fix vet error, ensure wait group in topologyClient isn't copied 2017-06-25 13:48:52 +01:00
Olaoluwa Osuntokun 5c45d52ab6 routing: wait for topology clients to fully exit before closing ntfn chan
This commit fixes a send on closed channel panic by adding additional
synchronization when cancelling the notifications for a particular
topology client. We now ensure that all goroutines belonging to a
particular topology client exit fully before we close the notification
channel in order to avoid a panic.
2017-06-25 13:31:55 +01:00
Olaoluwa Osuntokun 286026fbb9 htlcswitch: increase timeout in bidi payment test due to travis slowness 2017-06-21 13:36:28 +01:00
Olaoluwa Osuntokun 5dd7b157a0 lnwallet: fix race condition when forwarding by creating new pubkey
This commit fixes a race condition that would at times occur in the
htlcswitch.TestChannelLinkBidirectionalOneHopPayments test case. A race
condition would occur in the goroutine running ReceiveNewCommitment
compared with the grouting that would obtain the snapshot in order to
make a forwarding decision.

We fix this by creating a new public key for each new commitment
transaction such that we complete avoid the read/write race condition.
2017-06-19 17:43:57 +02:00
Olaoluwa Osuntokun 9dd5af4990 test: increase history size of race condition detector
This commit increases the history size of the race condition detector
such that we will more reliably be able to recover the stack in the
case that a race condition occurs.
2017-06-19 17:16:07 +02:00
Olaoluwa Osuntokun a95d56741d config: don't log to stderr if lnd.conf isn't found
This commit fixes a bit of a wart in the configuration file handling
wherein if the config file isn’t found, an error was printed to stderr.
At times, this would cause the testing framework to erroneously mark as
test as failed. Instead, we now keep a particular config file error,
and check that, printing to a warning log level.
2017-06-19 16:44:30 +02:00
Olaoluwa Osuntokun 0fc62f123d htlcswitch: log regular channel ID when registering channels 2017-06-19 16:39:45 +02:00
Olaoluwa Osuntokun 10ca654054 test: in async bi-di payment test wait for both sides to see the channel 2017-06-19 16:39:12 +02:00
Olaoluwa Osuntokun 276a360353 build: re-generate hash for glide file 2017-06-19 14:42:57 +02:00
Olaoluwa Osuntokun fa6c56f16e test: run utxo nursery tests serially 2017-06-19 14:28:19 +02:00
Olaoluwa Osuntokun e2e21243d2 htlcswitch: make linter happy on go 1.7 2017-06-17 01:10:08 +02:00
Olaoluwa Osuntokun 00448fb4ee features: add temp feature bit for recent onion payload changes 2017-06-17 01:04:27 +02:00
Olaoluwa Osuntokun 4b0e331c62 htlcswitch: fix linter issues 2017-06-17 01:04:21 +02:00
Olaoluwa Osuntokun 1be4d67ce4 multi: run all test instances in parallel 2017-06-17 01:00:07 +02:00
Olaoluwa Osuntokun bb9bc9205a htlcswitch: run all unit tests in parallel 2017-06-17 00:41:47 +02:00
Olaoluwa Osuntokun a43b5658bb test: update integration tests to account for base fees
In a recent commit, a default base fee of 1 satoshi has been added, as
a result we now need to factor in the fees paid in a multi-hop setting.
2017-06-17 00:20:14 +02:00
Olaoluwa Osuntokun b47ffde4ad funding: use default routing policy when advertising initial channel routing policy 2017-06-17 00:15:38 +02:00
Olaoluwa Osuntokun 89537318c1 chains: add default routing policy for current supported blockchains 2017-06-17 00:12:43 +02:00
Olaoluwa Osuntokun e15604f7b5 peer: ensure latest version of htlcswitch.Peer interface is implemented 2017-06-17 00:11:10 +02:00
Olaoluwa Osuntokun 11f7a227ab server: update to latest htlcswitch API changes 2017-06-17 00:10:22 +02:00
Olaoluwa Osuntokun cae99134e1 htlcswitch: add tests to exercise payload verification and policy change s 2017-06-17 00:09:53 +02:00
Olaoluwa Osuntokun 7fc09edb76 htlcswitch: update link tests to be aware of fee implementation, API changes 2017-06-17 00:08:26 +02:00
Olaoluwa Osuntokun e477241de1 htlcswitch: update test utilities to latest switch/link changes 2017-06-17 00:03:42 +02:00
Olaoluwa Osuntokun 399d193e2c htlcswitch: add a new UpdateFeePolicy to ChannelLink interface
This commit adds a new method to the ChannelLink interface which is
meant to allow outside sub-system to update the forwarding policy of a
channel. This can be triggered either by a new RPC method, or
automatically by some sort of control system which seeks to optimize
fee revenue, or block off channels, etc.
2017-06-17 00:01:10 +02:00
Olaoluwa Osuntokun cd10dc712f htlcswitch: implement full HTLC onion payload validation logic
This commit puts a missing piece in place by properly parsing and
validating the per hop payload received in incoming HTLC’s. When
forwarding HTLC’s we ensure that the payload recovered is consistent
with our current forwarding policy. Additionally, when we’re the “exit
node” for a payment, then we ensure that the HTLC extended matches up
with our expectation w.r.t the payment amount to be received.
2017-06-16 23:58:08 +02:00
Olaoluwa Osuntokun 1f5a4fcb8e htlcswitch: change over all internal indexes to use short channel ID's 2017-06-16 23:49:46 +02:00
Olaoluwa Osuntokun 4c7af9f16d htlcswitch: eliminate HopID in favor of a [33]byte for compressed pub keys 2017-06-16 23:38:52 +02:00
Olaoluwa Osuntokun ea57a94c2e htlcswitch: add a ShortChanID method to the ChannelLink interface 2017-06-16 23:32:47 +02:00
Olaoluwa Osuntokun 058e641d7e htlcswitch: add new ForwardingPolicy struct guide forwarding decisions 2017-06-16 23:31:00 +02:00
Olaoluwa Osuntokun 5cee9d4bf1 htlcswitch: modify the HopIterator interface to utilize per-hop payloads
This commit modifies the HopIterator interface to allow nodes that
receive incoming HTLC’s to make forwarding decisions based on the
returned peer hop information, rather than just the next hop. With this
change, we can now enforce our routing policy, and reject any HTLC’s
that violate the policy.
2017-06-16 23:29:44 +02:00
Olaoluwa Osuntokun 9a972a6fc3 htlcswitch: remove unused NewSphinxBlob function 2017-06-16 23:27:39 +02:00
Olaoluwa Osuntokun c3497e515b htlcswitch: add new ForwardingInfo struct to represent per-hop payloads 2017-06-16 23:26:56 +02:00
Olaoluwa Osuntokun 6937a42f2d lnwallet: add new ShortChanID method to LightningChannel 2017-06-16 23:25:13 +02:00
Olaoluwa Osuntokun 26c14c7de5 funding: we process the funding locked message _after_ shortChanID is known
This commit adds a new bit of synchronization to the funding manager to
ensure that we only process the funding locked message directly _after_
the short channel ID has become available within the channel. This
fixes a possible bug wherein we would receive the funding locked
message, and register the channel with the switch without yet knowing
the short chan ID. This would then cause any HTLC’s routed to the new
channel to fail, as it would be using the incorrect short channel ID.
2017-06-16 23:19:45 +02:00
Olaoluwa Osuntokun 4173b9748d funding: obtain and populate shortChanID for MarkChannelAsOpen
This commit modifies the funding process to use the short channel ID,
rather than only the opening block height to mark a channel as open
once it has been confirmed. With this change, the short channel ID
information will now be available immediately after the channel has
been confirmed in the chain.
2017-06-16 23:15:55 +02:00
Olaoluwa Osuntokun 1c0712ca03 discovery: update to recent lnwire.ChannelUpdate changes 2017-06-16 22:48:14 +02:00
Olaoluwa Osuntokun 319afb14f1 lnwire: update ChannelUpdate to latest spec change, min HTLC is 8-bytes 2017-06-16 22:46:36 +02:00
Olaoluwa Osuntokun 2452f2ed82 routing: update test to assert correctness of per-hop payloads 2017-06-16 22:45:30 +02:00
Olaoluwa Osuntokun fca51d6165 routing: use converted hop payloads for sphinx packet when creating onion 2017-06-16 22:43:00 +02:00
Olaoluwa Osuntokun 4d8bb21d9d routing: add ToHopPayloads method to routing.Route
This commit adds a new method to the routing.Route struct:
ToHopPayloads. This function will converts a complete route into the
series of per-hop payloads that is to be encoded within each HTLC using
an opaque Sphinx packet.

We can now use this function when creating the sphinx packet to
properly encoded the hop payload for each hop in the route.
2017-06-16 22:37:47 +02:00
Olaoluwa Osuntokun dfd37df0ed routing: set expiry on initial outgoing HTLC using total time lock 2017-06-16 22:35:14 +02:00
Olaoluwa Osuntokun 62cd6ee046 routing: populate the OutgoingTimeLock field within route hops
This commit inches towards fully validation+adherance of the per-hop
payloads within an HTLC’s route by properly calculating the outgoing
time lock value for each hop according to the current draft
specification.
2017-06-16 22:33:59 +02:00
Olaoluwa Osuntokun 4b8d052afc channeldb: replace opening height will short chan ID in OpenChannel
This commit modifies the OpenChannel struct to include the full short
channel ID rather than simply the opening height. This new field will
be needed by an upcoming change to uniformly switch to using short
channel ID’s when forwarding HTLC’s due to the change in per-hop
payloads.
2017-06-16 22:28:58 +02:00
Olaoluwa Osuntokun 3efd3c4f8c build: update glide to point to the latest version of lighting-onion 2017-06-10 18:15:31 -07:00
Olaoluwa Osuntokun 650ba7e1ca lnwire: update OnionPacketSize for new onion payload format
This commit updates the OnionPacketSize constant in order to reflect
the size of the onion payload as a result of the recent changes to the
sphinx packet format in the specification.
2017-06-10 18:15:09 -07:00
Olaoluwa Osuntokun 3d63a97443 build: update travis to build against go 1.7.5 and go 1.8.3 2017-06-10 18:10:14 -07:00
Olaoluwa Osuntokun e4563ca13b routing/chainview: make filter updates synchronous for neutrino
This commit fixes a possible race condition wherein a call to
FilterBlock after a call to UpdateFilter would result in the call to
FilterBlock not yet using the updated filter. We fix this by ensuring
the internal chain filter is updated by the time the call to
FilterBlock returns.
2017-06-09 12:18:33 -07:00
Olaoluwa Osuntokun 0c134a8cb3 routing/chainview: if the chain filter is empty, don't fetch the cfilter 2017-06-08 23:11:24 -07:00
Olaoluwa Osuntokun 885cc6b216 build: update glide to point to latest neutrino build 2017-06-08 22:26:40 -07:00
Olaoluwa Osuntokun 2e05051176 lnwallet: clarify comment within commitment state sanity function 2017-06-08 22:25:06 -07:00
Olaoluwa Osuntokun 9676d476c9 lnwallet: fix race condition in channel state machine, use single mutex
This commit fixes a race condition that was discovered as a result of
the new htlcswitch package. The StateSnapshot method and all of the
other methods which mutate the state of the channel state machine were
using distinct mutexes. The fix is trivial: all methods accessing the
internal channel state variable now use the same mutex.
2017-06-08 22:24:20 -07:00
Olaoluwa Osuntokun 38beeebe3d routing/chainview: optimize neutrino implementation of FilterBlock
This commit optimizes the neutrino implementation of FilterBlock method
of the ChainView interface. The old implementation would _always_ fetch
the entire block and manually scan through it. Instead, we can just
fetch the filter, and then if the items match, fetch the block itself.
This will save bandwidth during a lnd node’s pruning of the channel
graph after a period of dormancy.
2017-06-08 22:24:03 -07:00
Olaoluwa Osuntokun 5e2381a64c lnwallet: properly set FeeEstimator within integration tests 2017-06-07 17:22:46 -07:00
Olaoluwa Osuntokun 54cb8a05cd chainntnfs: fix vet error, don't pass lock by value 2017-06-07 17:07:33 -07:00
Olaoluwa Osuntokun baf769eaf0 chainntnfs/neutrinonotify: fix deadlock when notifying blocks, wait for epoch coroutines to exit 2017-06-07 17:05:22 -07:00
Olaoluwa Osuntokun 625d57aea6 chainntnfs/btcdnotify: ensure block epoch coroutines exit before closing ntfn channel 2017-06-07 17:04:32 -07:00
Olaoluwa Osuntokun ab2af76b44 chainntnfs: add proper logging for the two last interface-level tests 2017-06-07 17:03:01 -07:00
Olaoluwa Osuntokun af8d12ee1d build: update glide files to latest optimized version of neutrino 2017-06-07 17:02:19 -07:00
Olaoluwa Osuntokun dc40662770 lnwallet/btcwallet: properly pass in FeeEstimator to btcwallet
This commit fixes a bug wherein the wallet would use the default relay
fee to craft transactions. On testnet, this might be insufficient or be
rejected all together in a mainnet setting. Therefore, we now pass in
the FeeEstimator interface and ensure that it’s consulted in order to
set the relay fee the wallet will use to craft transactions.

Note that this is a hold over until we have true dynamic fee
calculation within lnd which can then be extended to the internal
wallets.
2017-06-07 17:01:27 -07:00
Olaoluwa Osuntokun 5adbc7fae3 lnwire: reduce range of randomly generated features in testing.Quick case
This commit reduces the range of the number of randomly generated
features in order to speed up the run time of the integration tests a
bit.
2017-06-07 16:54:49 -07:00
Olaoluwa Osuntokun 424ccccc2f docs: correct mistake in protoc version used 2017-06-07 16:52:58 -07:00
Olaoluwa Osuntokun 7d30634757 routing/chainview: fix race condition in neutrino implementation 2017-06-06 12:01:24 -07:00
Olaoluwa Osuntokun 9fd70958f4 multi: fix linter errors 2017-06-05 19:45:01 -07:00
Olaoluwa Osuntokun d202b730eb peer: fix peer API usage due to incomplete cherry-pick 2017-06-05 19:41:18 -07:00
Olaoluwa Osuntokun 91d4e6a377 lnwallet/btcwallet: fix duplicate imports 2017-06-05 19:41:12 -07:00
Olaoluwa Osuntokun cbf7cd48f5 multi: update to latest neutrino API changes 2017-06-05 19:41:07 -07:00
Olaoluwa Osuntokun e43412b820 build: update glide files to add neutrino, latest roasbeef forks 2017-06-05 19:41:04 -07:00
Olaoluwa Osuntokun 4b29c70c45 lnd: rename light client cmd line option to --neutrino.X=K 2017-06-05 19:23:09 -07:00
Olaoluwa Osuntokun aec8c8dc77 lnd: decouple rpcServer from server, wait till chain synced before starting server
This commit overhauls the way that lnd is created with the goal of
ensuring the chain backends are fully synced up before the daemon
itself starts. The rpcServer has been slightly decoupled from the
server itself s.t we can start the rpcServer independently of the
server. This is required as we’ll now wait (unless we’re in simnet
mode) for the chain to fully sync up before we even _start_ any of the
server’s goroutines.
2017-06-05 19:22:12 -07:00
Olaoluwa Osuntokun 467ccfde41 lnwallet: update interface test initiation for latest API change 2017-06-05 19:21:44 -07:00
Olaoluwa Osuntokun 3c5d856248 lnwallet: use current height as FundingBrodcastHeight during funding flow 2017-06-05 19:18:34 -07:00
Olaoluwa Osuntokun 54f849a62e lnwallet: use the FundingBroadcastHeight as height hint for spend ntfns 2017-06-05 19:17:13 -07:00
Olaoluwa Osuntokun e72b030054 funding: use FundingBrodcastHeight as height hint for conf registrations 2017-06-05 19:16:00 -07:00
Olaoluwa Osuntokun 66ba2e862c channeldb: store the funding transaction broadcast height for channels
This commit expands the field within the OpenChannel struct in order to
start tracking the height that the funding transaction was initially
broadcast. Other sub-systems within lnd can now use this data to give a
more accurate height hint to the ChainNotifier, or to use during the
funding workflow to decide if a channel should be forgotten after it
fails to confirm for N blocks.
2017-06-05 19:15:44 -07:00
Olaoluwa Osuntokun fb4121ba6c server: Peers method now grabs data directly with read mutex
This commit modifies the Peers method on the server such that a caller
is able to query this method without the main serger goroutines
started. This is a small component in a larger change which will let us
start the RPC server independently of the server.
2017-06-05 19:15:22 -07:00
Olaoluwa Osuntokun 593ba7c8f0 lnd: newChainControlFromConfig can now create light client backed chainControl
This commit finishes up the implementation of newChainControlFromConfig
in order to properly initiate the members of the chainControl struct
when the new light client mode (neutrino). With this lnd is now able to
switch over to either mode with a simple configuration change.
2017-06-05 19:14:41 -07:00
Olaoluwa Osuntokun 33decbe6ab fundingmanager: fix logging message 2017-06-05 19:12:56 -07:00
Olaoluwa Osuntokun 7d62293d4a lnwallet: remove GetTransaction method from BlockChainIO 2017-06-05 19:12:42 -07:00
Olaoluwa Osuntokun 0e8af209bd lnwallet/btcwallet: update BlockChainIO implementation to be backend aware 2017-06-05 19:12:00 -07:00
Olaoluwa Osuntokun aca729abfe lnwallet/btcwallet: update btcwallet config to be aware of new chain interface 2017-06-05 19:10:08 -07:00
Olaoluwa Osuntokun 392a8180dd chaintnfs/neutrinonotify: add additional logging 2017-06-05 19:08:30 -07:00
Olaoluwa Osuntokun 0050108391 chainntnfs/btcdnotify: fix off-by one error when setting spending height 2017-06-05 19:07:48 -07:00
Olaoluwa Osuntokun 065f646ef8 chainntnfs: add the neutrino implementation to the set of interface tests
This commit adds a new case and proper initialization for the
NeutrinoNotifier implementation, such that it can be tested in-line
with the other implementations for proper behavior conformity.

Due to a delay when btcd sends invs for new blocks, the timeouts for
several of the tests has been extended in order to give enough time for
propagation of the new block.
2017-06-05 19:07:04 -07:00
Olaoluwa Osuntokun 8f81133d6c chainntnfs/neutrinonotify: add ChainNotifier implementation for neutrino
This commit adds an initial rough implementation father ChainNotifier
interface for neutrino, our new light client implementation. This
implementation largely borrows from the existing BtcdNotifier
implementation. As a result, a follow up commit will perform two
refactoring in order to further consolidate code.
2017-06-05 19:04:56 -07:00
Olaoluwa Osuntokun 48ea8a3e70 routing/chainview: add neutrino light client to set of interface tests 2017-06-05 18:58:53 -07:00
Olaoluwa Osuntokun cc25049684 routing/chainview: add new light client p2p version of FilteredChainView
This commit adds a new implementation of the FilteredChainView
interface. This implementation speaks purely to the p2p network and is
backed by a new experimental light client implementation.
2017-06-05 18:57:36 -07:00
Olaoluwa Osuntokun 461d84dd75 routing/chainview: report line # in test failures, bump up timeouts 2017-06-05 18:54:58 -07:00