lnd.xprv/lnwallet/btcwallet
Olaoluwa Osuntokun bd46491d07 lnwallet: fix key derivation for very first key in family
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.
2019-07-08 17:08:39 -07:00
..
blockchain.go lnwallet/btcwallet: provide cancel chan as neutrino QuitChan option 2019-05-09 14:44:52 +02:00
btcwallet.go lnwallet/btcwallet: use relay fee not tx fee rate for dust check 2019-06-18 19:55:16 -07:00
config.go lnwallet+chainregistry: remove unused FeeEstimator from wallet cfg 2019-04-16 14:16:56 -07:00
driver.go multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
signer.go lnwallet: fix key derivation for very first key in family 2019-07-08 17:08:39 -07:00