mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
lnwallet+htlcswitch: add NewCommitState struct, modify send/recv sig to accept
In this commit, we add a new NewCommitState struct. This preps us for the future change wherein a partial signature is also added to the mix. All related tests and type signatures have also been updated accordingly.
This commit is contained in:
@@ -495,11 +495,12 @@ func calcStaticFee(chanType channeldb.ChannelType, numHTLCs int) btcutil.Amount
|
||||
// pending updates. This method is useful when testing interactions between two
|
||||
// live state machines.
|
||||
func ForceStateTransition(chanA, chanB *LightningChannel) error {
|
||||
aliceSig, aliceHtlcSigs, _, err := chanA.SignNextCommitment()
|
||||
aliceNewCommit, err := chanA.SignNextCommitment()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = chanB.ReceiveNewCommitment(aliceSig, aliceHtlcSigs); err != nil {
|
||||
err = chanB.ReceiveNewCommitment(aliceNewCommit.CommitSigs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -507,7 +508,7 @@ func ForceStateTransition(chanA, chanB *LightningChannel) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bobSig, bobHtlcSigs, _, err := chanB.SignNextCommitment()
|
||||
bobNewCommit, err := chanB.SignNextCommitment()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -515,7 +516,7 @@ func ForceStateTransition(chanA, chanB *LightningChannel) error {
|
||||
if _, _, _, _, err := chanA.ReceiveRevocation(bobRevocation); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := chanA.ReceiveNewCommitment(bobSig, bobHtlcSigs); err != nil {
|
||||
if err := chanA.ReceiveNewCommitment(bobNewCommit.CommitSigs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user