mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
lnwallet: extract initMusigNonce from initRevocationWindows
This'll be useful later to make some enhancements to the existing unit tests.
This commit is contained in:
parent
69a1cf4f23
commit
528199839a
@ -435,14 +435,9 @@ func CreateTestChannels(t *testing.T, chanType channeldb.ChannelType,
|
|||||||
return channelAlice, channelBob, nil
|
return channelAlice, channelBob, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// initRevocationWindows simulates a new channel being opened within the p2p
|
// initMusigNonce is used to manually setup musig2 nonces for a new channel,
|
||||||
// network by populating the initial revocation windows of the passed
|
// outside the normal chan-reest flow.
|
||||||
// commitment state machines.
|
func initMusigNonce(chanA, chanB *LightningChannel) error {
|
||||||
func initRevocationWindows(chanA, chanB *LightningChannel) error {
|
|
||||||
// If these are taproot chanenls, then we need to also simulate sending
|
|
||||||
// either FundingLocked or ChannelReestablish by calling
|
|
||||||
// InitRemoteMusigNonces for both sides.
|
|
||||||
if chanA.channelState.ChanType.IsTaproot() {
|
|
||||||
chanANonces, err := chanA.GenMusigNonces()
|
chanANonces, err := chanA.GenMusigNonces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -458,6 +453,21 @@ func initRevocationWindows(chanA, chanB *LightningChannel) error {
|
|||||||
if err := chanB.InitRemoteMusigNonces(chanANonces); err != nil {
|
if err := chanB.InitRemoteMusigNonces(chanANonces); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// initRevocationWindows simulates a new channel being opened within the p2p
|
||||||
|
// network by populating the initial revocation windows of the passed
|
||||||
|
// commitment state machines.
|
||||||
|
func initRevocationWindows(chanA, chanB *LightningChannel) error {
|
||||||
|
// If these are taproot chanenls, then we need to also simulate sending
|
||||||
|
// either FundingLocked or ChannelReestablish by calling
|
||||||
|
// InitRemoteMusigNonces for both sides.
|
||||||
|
if chanA.channelState.ChanType.IsTaproot() {
|
||||||
|
if err := initMusigNonce(chanA, chanB); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aliceNextRevoke, err := chanA.NextRevocationKey()
|
aliceNextRevoke, err := chanA.NextRevocationKey()
|
||||||
|
Loading…
Reference in New Issue
Block a user