remoteUpdateLog from localCommit This commit fixes a bug within channel.go that would lead to the content of the update logs and their indexes getting out of sync during restores. The scenario that could occur was that the localUpdateLog was initiated with a log index taken from the localCommitment. Updates we send (which are added to the localUpdateLog) will be added to the remote commitment first. The problem happened when an update was sent and added to the remote commitment, but not ACKed. Since it was not ACKed, we would not add it to our local commitment. During a restart/restore we would init the localUpdateLog with a height too low, such that when going through the outgoing HTLCs on the remote commitment, we would restore an HTLC at an index higher than our local log HTLC counter. The symmetric change is done to the remoteUpdateLog.
lnwallet
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