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:
3 files changed
+106
-63
No files matched your search
@@ -225,6 +225,7 @@ func createTestChannels(revocationWindow int) (*LightningChannel, *LightningChan
|
||||
}
|
||||
fundingTxIn := wire.NewTxIn(prevOut, nil, nil)
|
||||
|
||||
// TODO(roasbeef): use distinct keys
|
||||
aliceCfg := channeldb.ChannelConfig{
|
||||
ChannelConstraints: channeldb.ChannelConstraints{
|
||||
DustLimit: aliceDustLimit,
|
||||
@@ -238,6 +239,7 @@ func createTestChannels(revocationWindow int) (*LightningChannel, *LightningChan
|
||||
RevocationBasePoint: aliceKeyPub,
|
||||
PaymentBasePoint: aliceKeyPub,
|
||||
DelayBasePoint: aliceKeyPub,
|
||||
HtlcBasePoint: aliceKeyPub,
|
||||
}
|
||||
bobCfg := channeldb.ChannelConfig{
|
||||
ChannelConstraints: channeldb.ChannelConstraints{
|
||||
@@ -252,6 +254,7 @@ func createTestChannels(revocationWindow int) (*LightningChannel, *LightningChan
|
||||
RevocationBasePoint: bobKeyPub,
|
||||
PaymentBasePoint: bobKeyPub,
|
||||
DelayBasePoint: bobKeyPub,
|
||||
HtlcBasePoint: bobKeyPub,
|
||||
}
|
||||
|
||||
bobRoot := DeriveRevocationRoot(bobKeyPriv, testHdSeed, aliceKeyPub)
|
||||
|
||||
Reference in new issue
Block a user