In this commit, we create the initial CODEOWNERS file for `lnd`. This
file is a new-ish feature of Github that allows the maintains of a
project to define the individuals who are deemed to be experts of a
particular section of the codebase. Automated review assignment systems
can then use this file to generate required reviewers for a section of
the project. The CODEOWNERS file isn't meant to be a strict guideline,
but instead can be used to ease the burden of finding reviewers for a
particular section of the codebase.
It's also possible to enforce that the CODEOWNERS for a particular
file/package sign-off on relevant changes, thereby blocking review
unless they're involved. However, for now we'll simply use it to guide
the review assignment project, leaving creating blocking review
constraints until a later point if deemed useful.
In this commit, we fix an existing bug that would cause us to be unable
to derive the very first key in a key family if the wallet hadn't
already derived it in the past. This can happen if a user keeps their
same `channel.db`, but restores their wallet resulting in fresh
`wallet.db` state.
This is an existing issue due to the fact that we don't properly
distinguish between an empty key locator, and the very first key in a
`KeyFamily`: `(0, 0)`. Atm, `KeyLoactor{0, 0}.IsEmpty() == True`,
causing us to be unable to retrieve this key in certain cases since we
fall through and attempt address based derivation.
In order to remedy this, we add a new special case (until we upgrade
`KeyLoactor` formats, but needed for legacy reasons) to _try_ a regular
`KeyLoactor` based derivation if we fail to derive via address, and this
is an "empty" key loc. This has been tested in the field and shown to
work, with the one downside that in this "hot swap restoration" case,
we'll hit the database twice to derive the key.
This commit moves the call to PruneGraph outside of the loop
that collates all of the spentOutputs. With this change, if
a node has been offline for a long period of time, resyncing
with the chain no longer takes up as much memory (1MB vs 200MB
in some cases) or time. Previously, PruneGraph was called
for every block and allocated a very large map further down
in the pruneGraphNodes function. Now, pruneGraphNodes is only
called once.
This commit fixes a bug in the openChannelShell function where,
instead of properly returning an error when failing to derive
the shachain root's private key, nil was returned instead. This
would lead to a panic as the channel shell was then referenced
further down in the callstack. An error is now properly returned.
In this commit we add exponential back off to the `initialPeerBootstrap`
method. Before this change, if the DNS seed was down, we would hammer it
in an attempt to get our initial set of peers. This makes this section a
bit less aggressive, but saves log spam and also will hit the DNS
servers less frequently.
In this commit, we modify the `SampleNodeAddrs` method to no longer
retry itself. Instead, we'll now leave this task to the caller of the
this method. Additionally, we'll no longer return with an error if we
can't hit a particular seed. Instead, we'll log the error and move onto
the next seed. Finally, we'll also no longer require that the DNS seed
has a secondary seed in order to support a wider array of DNS seeds.