In this commit, we modify all existing historical rescans for
ChainNotifier backends to scan backwards rather than forwards. If we
know that a transaction has been confirmed, or outpoint spent, the it's
likely that the event has recently transpired assuming we've been
offline for a short period of time. Therefore, if we scan backwards
rather than forwards, then we can save potentially hundreds or thousands
of block fetches if the event recently happened close to the tip of the
chain.
We bound this search at the genesis block, to ensure we don't underflow
the uint32 used throughout the package in the main loop.
This adds the scenario where a channel is closed while the node is
offline, the node loses state and comes back online. In this case the
node should attempt to resync the channel, and the peer should resend a
channel sync message for the closed channel, such that the node can
retrieve its funds.
We pool the database for the channel commit point with an exponential
backoff. This is meant to handle the case where we are in process of
handling a channel sync, and the case where we detect a channel close
and must wait for the peer to come online to start channel sync before
we can proceed.
This commit adds an optional field LastChanSyncMsg to the
CloseChannelSummary, which will be used to save the ChannelReestablish
message for the channel at the point of channel close.
This commit adds a new file legacy_serialization.go, where a copy of the
current deserializeCloseChannelSummary is made, called
deserializeCloseChannelSummaryV6.
The rationale is to keep old deserialization code around to be used
during migration, as it is hard maintaining compatibility with the old
format while changing the code in use.
This extracts part of the test into a new helper method timeTravel,
which can be used to easily reset a node back to a state where channel
state is lost.
One way applications built on top of lnd can estimate sync percentage is
through comparing the current time to the best known timestamp of the
lnd wallet's sync state. Therefore, we should always return this
information even if the the wallet is not synced.
In this commit, we update our btcwallet dependency that includes a fix
to address an issue that would cause users to be stuck in an infinite
loop by fetching the same candidate birthday block due to its height not
being updated if the sanity check was attempting to fix an estimate in
the future.
Move num_inactive_channels closer to num_active_channel,
best_header_timestamp closer to block_hash/block_height and version as
first item in the list.
This commit sets the GOCACHE environment variable, and enables caching
on travis.
GOCACHE will tell the compiler (only go 1.10+) where to store build and
test artifacts. Caching this directory will significantly speed up
succeeding builds and test runs.
We also cache vendor/ as this will speed up the call to 'make dep'.
A few dependencies in the GOPATH are cached, as calls to 'go get' for
these will be sped up. Note that we don't cache the lnd directory, as it
will conflict with the changes in the PR being built.
This commit distributes the CI tests into 3 independend builds, by
splitting the integration test run and unit test coverage.
To better handle the extra cases, we define a build matrix with the
three build types (RACE and LINT, ITEST, COVER).
Instead of calling 'make travis' directly, we call each step. This lets us
better track how much time is spent on each.
Also note that we execute 'itest-only' instead of 'itest', and instead
execute the dependencies (btcd, build) manually first.
We explicitly set the ITEST environment variable, for readability, and
define a new COVER. This is currently true when ITEST=true to keep the
existing build configuration, but will later be configured to be
independent.
'itest-only' can be used to only run integration tests, not build any of
the dependencies. This is useful on travis, where manually executing
each command makes it easier to track the time spent on each.
In this commit, we update to the latest version of btcwallet. This
version includes a bug fix which ensures that the wallet birthday sanity
check only executes once and not each time the deamon is restarted.
In this commit, we add an additional check to btcwallet's IsSynced
method to ensure that it is not currently undergoing a rescan. We do
this to block upon starting the server and all other dependent
subsystems until the rescan is complete.
In this commit, we add the lightning address scope before the wallet
starts to prevent a race condition between the wallet syncing and adding
the scope itself. This became more apparent with the recent btcwallet
fixes, as several database transactions now occur between the wallet
being started and it syncing.
In this commit, we update our btcwallet dependency to include the latest
changes that aim to address the recently discovered SendOutputs bug.
This commit will also allow the lnwallet test case added in the
previous commit to succeed.
In this commit, we add a new test to the existing set of wallet tests to
ensure we can properly detect the confirmation of transactions that
spend our change outputs. We do this as a measure to prevent future
regressions from happening where the wallet doesn't request its backend
to be notified of when an on-chain transaction pays to a change address,
like with the recently discovered SendOutputs bug.
As is, this test will not pass until we update the btcwallet dependency
in the next commit.