lnd.xprv/lnwallet
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
..
btcwallet lnwallet: fix key derivation for very first key in family 2019-07-08 17:08:39 -07:00
channel_test.go multi: address lingering TODO by no longer wiping out local HTLCs on remote close 2019-05-27 14:34:13 -07:00
channel.go lnwallet/channel: use proper commitment output sorting 2019-06-05 08:35:06 +02:00
commit_sort_test.go lnwallet/commit_sort: add commit sorting with htlc tie breaker 2019-06-05 08:34:45 +02:00
commit_sort.go lnwallet/commit_sort: add commit sorting with htlc tie breaker 2019-06-05 08:34:45 +02:00
config.go multi: move Input interface and related code 2019-01-31 13:25:33 +01:00
errors.go Revert "funding+lnwallet: ensure max_htlc_value_in_flight smaller than capacity" 2019-01-29 17:58:04 -08:00
fee_estimator_test.go lnwallet: add new WebApiFeeEstimator for API fee estimation. 2019-04-16 14:16:53 -07:00
fee_estimator.go lnwallet+sweep: add String method to FeePreference 2019-05-24 15:30:36 -07:00
interface_test.go lnwallet: fix logic in testCreateSimpleTx test case 2019-06-18 19:55:24 -07:00
interface.go Merge pull request #3187 from yaslama/UnknownAsDefaultAddressType 2019-06-17 12:18:55 +02:00
log.go multi: init subsystem loggers via build pkg 2018-10-05 13:04:45 +09:00
parameters.go multi: move Input interface and related code 2019-01-31 13:25:33 +01:00
README.md multi: fix typos in comments 2018-04-17 19:03:27 -07:00
reservation.go Typo corrections in various comments 2019-05-10 17:15:54 +02:00
sigpool.go multi: move Input interface and related code 2019-01-31 13:25:33 +01:00
size_test.go multi: move Input interface and related code 2019-01-31 13:25:33 +01:00
test_utils.go multi: address lingering TODO by no longer wiping out local HTLCs on remote close 2019-05-27 14:34:13 -07:00
transactions_test.go channel+cnct: remove preimage from channel and resolution 2019-05-15 14:41:49 +02:00
transactions.go multi: move Input interface and related code 2019-01-31 13:25:33 +01:00
wallet.go lnwallet/wallet: add missing error handling 2019-05-09 14:44:53 +02:00

lnwallet

Build Status MIT licensed GoDoc

The lnwallet package implements an abstracted wallet controller that is able to drive channel funding workflows, a number of script utilities, witness generation functions for the various Lightning scripts, revocation key derivation, and the commitment update state machine.

The package is used within lnd as the core wallet of the daemon. The wallet itself is composed of several distinct interfaces that decouple the implementation of things like signing and blockchain access. This separation allows new WalletController implementations to be easily dropped into lnd without disrupting the code base. A series of integration tests at the interface level are also in place to ensure conformance of the implementation with the interface.

Installation and Updating

$ go get -u github.com/lightningnetwork/lnd/lnwallet