Commit Graph

2427 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
3764e5c65e
funding: by default, signal to announce initiated channel to network 2017-11-09 12:00:18 -08:00
Olaoluwa Osuntokun
9a2c2cdf86
lnwire: add new FundingFlag type for OpenChannel
In this commit we add a new type to the lnwire package: FundingFlag.
This type will serve as an enum to describe the possible flags that can
be used within the ChannelFlags field in the OpenChannel struct.

We also define the first assigned flag: FFAnnounceChannel, which
indicates if the initiator of the funding flow wishes to announce the
channel to the greater network.
2017-11-09 11:59:37 -08:00
Olaoluwa Osuntokun
1b69940a84
Merge pull request #369 from cfromknecht/nursery-store
Adds Nursery Store, preliminary step to 2nd-layer HTLC persistence
2017-11-06 17:33:38 -08:00
Conner Fromknecht
d0155f3128
nursery_store: make GraduateKinder only accept height + list channels 2017-11-06 17:01:17 -08:00
Conner Fromknecht
0ed5f83dce
nursery_store: adds kindergarten txn finalization 2017-11-06 17:01:17 -08:00
Conner Fromknecht
ef81f0064c
nursery_store: tightens up height index pruning and formatting 2017-11-06 17:01:17 -08:00
Conner Fromknecht
23e36a58f0
nursery_store: refactors ifaces to be more atomic
Also includes:
 * improved error handling when pruning channels
 * more aggressively signals errors when enumerating height outputs
 * removes use of variadic functions in Incubate, AwardDiplomas
 * renames AwardDiplomas to GraduateKinder
 * short circuits channel maturity test after finding 1 non-grad output
 * replaces prefixed outputs in height buckets with files, instead of
     empty buckets
2017-11-06 17:01:17 -08:00
Conner Fromknecht
f02f1355e7
nursery_store: adds graduating state and proper finalization 2017-11-06 17:01:16 -08:00
Conner Fromknecht
a8450875f6
nursery_store: adds a new file for utxon database
This commit introduces a new type called a NurseryStore
  which abstract many of the persistent operations required
  by the utxo nursery. The code in this commit is
  intentionally introduced as dead code, as the utxo
  nursery will later be modified to hook into the new
  database. It is designed to support incubation of
  commitment and htlc outputs, and includes full
  chain segmentation!
2017-11-06 17:01:16 -08:00
Olaoluwa Osuntokun
5dbf5084e7
routing: fix linter error 2017-11-06 16:49:36 -08:00
Olaoluwa Osuntokun
9294358b5b
routing: populate the chain filter before calling syncGraphWithChain
In this commit we fix an existing bug within the ChannelRouter. Before
this commit, we would sync our graph prune state, *then* update the
cain filter. This is incorrect as the blocks we manually pruned may
have included channel closing transactions. As a result, we would miss
the pruning of a set of channels, and assume that they were still
active.

In this commit, we fix this by reversing the order: we first update the
chain filter and THEN sync the channel graph.
2017-11-06 16:10:24 -08:00
Olaoluwa Osuntokun
ccf94e9457
routing: add new TestRouterChansClosedOfflinePruneGraph test
In this commit we add a new test to the set of unit tests for the
ChannelRouter: TestRouterChansClosedOfflinePruneGraph. This tests that
if channels are closed while the ChannelRouter is down, then upon
restart the channels are properly recognized as being closed.
2017-11-06 16:06:15 -08:00
Olaoluwa Osuntokun
2824f45aad
routing: update tests to adhere to new newMockChainView API 2017-11-06 16:00:57 -08:00
Olaoluwa Osuntokun
3be905109c
routing: add RestartRouter method to testCtx 2017-11-06 16:00:22 -08:00
Olaoluwa Osuntokun
cdf2f43432
routing: add Reset() method to mockChainView
In this commit, we add a Reset() method to the mockChainView struct.
With this new method tests are able to fully simulate a restart of the
ChannelRouter. This is necessary as the FilteredChainView instances are
assumed to be stateless, and don’t write their state to disk before a
restart.
2017-11-06 15:58:57 -08:00
Olaoluwa Osuntokun
fea8cbf920
routing: add quit channel to mockChainView 2017-11-06 15:57:29 -08:00
Olaoluwa Osuntokun
4f32ee94ea
routing: implement FilterBlock for mockChainView 2017-11-06 15:56:31 -08:00
Olaoluwa Osuntokun
5f915280bc
routing/chainview: if column wrapping on comments in neutrino.go 2017-11-06 15:55:21 -08:00
Olaoluwa Osuntokun
0ec22cc897
build: update to latest btcd+btcutil+btcwallet with gcs fixes 2017-11-03 12:35:33 -07:00
Olaoluwa Osuntokun
9eb5b7a0ea
test: add additional sleep in testOpenChannelAfterReorg 2017-11-02 21:30:25 -07:00
Alex
93aa140e9a build: update glide for new btcutil, btcd, neutrino, and btcwallet 2017-11-02 20:04:07 -07:00
Alex
50d88e7769 chainntfns/neutrinonotify: update driver to comply with BIP 2017-11-02 20:04:07 -07:00
Alex
1c408adcab routing/chainview: update neutrino driver to comply with BIP 2017-11-02 20:04:07 -07:00
Olaoluwa Osuntokun
215d57acb9
Merge pull request #364 from halseth/reorg-awareness
ChannelRouter and graph re-org awareness

Fixes #270
2017-11-02 17:07:47 -07:00
Olaoluwa Osuntokun
184b56f81e
Merge pull request #395 from cfromknecht/discovery-msg-stream
peer: add async queue for gossiper msgs
2017-11-02 16:12:20 -07:00
Johan T. Halseth
029082fb82
lnd_test: add channel graph reorg test
This commit adds a test for an lnd instance experiecing a reorg,
making sure a channel that is in the channel graph (using the
describegraph rpc call) will no longer be after the funding tx
gets reorged out.
2017-11-03 00:05:33 +01:00
Johan T. Halseth
256db86b02
routing: make channel router aware of stale blocks
This commit make the channel router handle the case where
it wakes up on a stale branch, and also the case where a
reorg happens while it is active.
2017-11-03 00:05:32 +01:00
Johan T. Halseth
8eb994c14b
routing/chainView test: add testFilterBlockDisconnected
This commit adds a test for the FilteredChainView interfaces,
making sure they notify about disconnected/connected blocks
in the correct order during a reorg.
2017-11-03 00:05:31 +01:00
Johan T. Halseth
6d15be5b79
routing/chainview: use blockEventQueue for neutrino block events
This commit makes use of the blockEventQueue within the neutrino
implementation of FilteredChainView to ensure connected and
disconnected blocks are consumed in order by the reader.

It also specifies that neutrino is not to send disconnected blocks
notifications during rescans, making it consistent with the btcd
implementation.
2017-11-03 00:05:30 +01:00
Johan T. Halseth
082f012fcf
routing/chainview: implement staleBlocks for btcd view.
This commit moves btcd view away from using the deprecated
callbacks onBlockConnected/Disconnected, and instead use
onFilteredBlockConnected/disconnected.

This commit also implements the sending of disconnected blocks
over the staleBlocks channel. To send these blocks, the
blockEventQueue is used to ensure the ordering of blocks are
correctly kept.

It also changes the way filter updates are handled. Since we
now load the tx filter to the rpc server itself, we can call
RescanBlocks instead of manually filtering blocks. These
rescanned blocks are also added to the blockEventQueue,
ensuring the ordering is kept.
2017-11-03 00:05:30 +01:00
Johan T. Halseth
e9c2f703d9
routing/chainview: additional comments to FilteredChainView godoc 2017-11-03 00:05:29 +01:00
Johan T. Halseth
a219aca0d3
routing/chainView: add blockEventQueue data structure
blockEventQueue is an ordered queue for block events sent from a
FilteredChainView. The two types of possible block events are
connected/new blocks, and disconencted/stale blocks. The
blockEventQueue keeps the order of these events intact, while
still being non-blocking. This is important in order for the
chainView's call to onFilteredBlockConnected/Disconnected to not
get blocked, and for the consumer of the block events to always
get the events in the correct order.
2017-11-03 00:05:28 +01:00
Johan T. Halseth
b26560e0f4
channeldb: add DisconnectBlockAtHeight
This commit adds the method DisconnectBlockAtHeight to the channel
graph database, making it possible to "rewind" the database in case
a block is disconnected from the main chain. To accomplish this,
a prune log is introduced, making it possible to keep track of the
point in time where the database was pruned. This is necessary for
the case where lnd might wake up on a stale branch, and must "walk
backwards" on this branch after it finds a common block fro the
graph database and the new main chain.
2017-11-03 00:05:19 +01:00
Conner Fromknecht
04a56e7286
peer: add async queue for gossiper msgs
This commit refactors the core logic of the
  chanMsgStream to support an additional stream
  that is used to asynchronously queue for in-order
  delivery to the authenticated gossiper. The channel
  streams are slightly adapted to use the more flexible
  primitive. We may look to refactor this using more
  isolated interfaces, but for now this provides a
  minimal change to resolving known flakes.
2017-11-02 15:57:12 -07:00
Olaoluwa Osuntokun
8a9cf9af16
test: make assertNumOpenChannelsPending poll every 200ms
In this commit, we modify the assertNumOpenChannelsPending to poll
every 200ms rather than just a single attempt. The goal of this commit
is to reduce the number of flakes on travis caused by slow instances.
2017-11-02 15:48:06 -07:00
Olaoluwa Osuntokun
34a165dd12
test: modify assertNumConnections to use a stoppable ticker 2017-11-02 15:45:19 -07:00
Olaoluwa Osuntokun
b3000b621b
brontide: within tests, listen on localhost rather than all interfaces 2017-11-01 15:30:57 -07:00
Olaoluwa Osuntokun
eb84d34b8d
brontide: don't run tests that use establishTestConnection in parallel 2017-11-01 15:12:13 -07:00
Olaoluwa Osuntokun
e0561c98c9
build: update to latest golang versions 2017-11-01 14:55:14 -07:00
Olaoluwa Osuntokun
6a42e9057d
brontide: ensure connections are closed after test completion 2017-11-01 13:55:49 -07:00
Olaoluwa Osuntokun
1899847823
brontide: make establishTestConnection full async
In this commit we modify the establishTestConnection() function that
each of the brontide unit tests utilize. Before this commit, we would
fully block on the Accept method of the listener. Since then it has
been observed, that at times if Accept blocks indefinitely, then the
entire test will fail after 10 minutes. To allow the test to return
early with a pertinent error, we’ll now make the entire test async, so
we can immediately return with an error if detected.
2017-11-01 13:28:29 -07:00
Olaoluwa Osuntokun
b28d613b07
build: add github.com/miekg/dns to set of dependancies 2017-10-30 19:08:57 -07:00
Olaoluwa Osuntokun
65cf83489a
discovery: fix linter warning 2017-10-30 19:04:00 -07:00
Olaoluwa Osuntokun
991a2fbb5f
chainregistry: add shim for TCP fallback for current DNS seed 2017-10-30 19:02:56 -07:00
Olaoluwa Osuntokun
5b226a9d37
discovery: add TCP fallback for DNSSeedBootstrapper
In this commit, we add a TCP fallback option for the
DNSSeedBootstrapper. We’ve received many reports of users unable to
bootstrap properly to the network due to the size of the SRV records we
currently return. It has been observed that many revolvers will simply
truncate and ignore the response due to the (current size).

To resolve (no pun intended) we now attempt to detect this failure mode
and will fallback to a manual TCP resolution in the case that our SRV
query over UDP fails. We do this by querying the special record at the
"soa." sub-domain of supporting DNS servers. The retuned IP address
will be the IP address of the authoritative DNS server. Once we have
this IP address, we'll connect manually over TCP to request the SRV
record. This is necessary as the records we return are currently too
large for a class of resolvers, causing them to be filtered out.
2017-10-30 19:00:27 -07:00
Olaoluwa Osuntokun
9bcb139bcc
autopilot: shuffle set of candidates using Fisher–Yates before selecting
In this commit we modify the ConstrainedPrefAttachment.Select method to
first shuffle the set of potential candidates before selecting them.
This serves to remove the existing grouping between candidates which
may have influenced the selection.
2017-10-30 18:55:55 -07:00
Olaoluwa Osuntokun
5ced45af01
docker/lnd: start container w/o prompting user for wallet passphrase
In this commit we restore the prior workflow of the docker-compose set
up with have to allow developers to quickly erect an lnd+btcd instance.
In a recent change, we now prompt the user for a passphrase that will
be used to encrypt the wallet database. This affected the prior
workflow, as it assumed set up was non-interactive.

In this commit we restore the prior behavior as we now start the lnd
nodes with --noencryptwallet.
2017-10-30 18:40:51 -07:00
Olaoluwa Osuntokun
a559319543
docker: update maintainer for lnd+ltcd docker files 2017-10-30 18:38:37 -07:00
nsa
9c0c889131 funding: decouple funding wait from fundingLocked and chanAnn
This commit decouples the wait for funding transaction confirmations
in the waitForFundingConfirmation function from the announcement of
the channel in the sendFundingLockedAndAnnounceChannel function.
Additionally, the sendFundingLockedAndAnnounceChannel function is
now decoupled into the sendFundingLocked and sendChannelAnnouncement
functions. There is also now a helper function that houses creation
of a lnwire.LightningChannel object, calls to both sendFundingLocked
and sendChannelAnnouncement.
2017-10-27 16:43:07 -07:00
Conner Fromknecht
3b2e4caa93 discovery/gossiper: isolate sync with node from query
This commit refactors the SynchronizeNode logic such that
  it can be called without interacting with the gossiper's
  main execution loop. This method does not require access
  to any of the gossiper's internal state, making the change
  fairly straightforward. The primary motivation behind
  this change is to minimize the possibility of introducing
  deadlock scenarios between the gossiper and server.
2017-10-27 15:48:37 -07:00