lnwallet: update commitmentKeyRing to account for distinct HTLC keys

In this commit, we update all the key derivation within the state
machine to account for the recent spec change which introduces a
distinct key for usages within all HTLC scripts. This change means that
the commitment payment and delay base points, are only required to be
online in the case that a party is forced to go to chain.

We introduce an additional local tweak to the keyring for the HTLC
tweak. Additionally, two new keys have been added: a local and a remote
HTLC key. Generation of sender/receiver HTLC scripts now use the local
and remote HTLC keys rather than the “payment” key for each party.
Finally, when creating/verifying signatures for second-level HTLC
transactions, we use these the distinct HTLC keys, rather than re-using
the payment keys.
This commit is contained in:
Olaoluwa Osuntokun
2017-11-14 20:48:49 -08:00
parent a812974808
commit d7cdf822e3
3 changed files with 106 additions and 63 deletions

View File

@@ -74,7 +74,7 @@ func TestCommitmentSpendValidation(t *testing.T) {
keyRing := &commitmentKeyRing{
delayKey: aliceDelayKey,
revocationKey: revokePubKey,
paymentKey: bobPayKey,
noDelayKey: bobPayKey,
}
commitmentTx, err := CreateCommitTx(fakeFundingTxIn, keyRing, csvTimeout,
channelBalance, channelBalance, DefaultDustLimit())