mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
lnwallet: RevokeCurrentCommitment now returns the set of active HTLC's
In this commit, we modify the RevokeCurrentCommitment method to now return the set of active HTLC’s. This will be used by callers in the future to update other sub-systems when the set of HTLC’s on the commitment changes, and can also be used on the RPC level to synchronize systems level integration tests.
This commit is contained in:
parent
75d2f09d4c
commit
5f6c15cfa4
1 changed files with 8 additions and 5 deletions
|
@ -3793,14 +3793,17 @@ func (lc *LightningChannel) FullySynced() bool {
|
|||
// transaction in the local commitment chain. As a result the edge of our
|
||||
// revocation window is extended by one, and the tail of our local commitment
|
||||
// chain is advanced by a single commitment. This now lowest unrevoked
|
||||
// commitment becomes our currently accepted state within the channel.
|
||||
func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, error) {
|
||||
// commitment becomes our currently accepted state within the channel. This
|
||||
// method also returns the set of HTLC's currently active within the commitment
|
||||
// transaction. This return value allows callers to act once an HTLC has been
|
||||
// locked into our commitment transaction.
|
||||
func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, []channeldb.HTLC, error) {
|
||||
lc.Lock()
|
||||
defer lc.Unlock()
|
||||
|
||||
revocationMsg, err := lc.generateRevocation(lc.currentHeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
walletLog.Tracef("ChannelPoint(%v): revoking height=%v, now at height=%v",
|
||||
|
@ -3817,7 +3820,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, err
|
|||
newCommitment := chainTail.toDiskCommit(true)
|
||||
err = lc.channelState.UpdateCommitment(newCommitment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
walletLog.Tracef("ChannelPoint(%v): state transition accepted: "+
|
||||
|
@ -3829,7 +3832,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, err
|
|||
&lc.channelState.FundingOutpoint,
|
||||
)
|
||||
|
||||
return revocationMsg, nil
|
||||
return revocationMsg, newCommitment.Htlcs, nil
|
||||
}
|
||||
|
||||
// ReceiveRevocation processes a revocation sent by the remote party for the
|
||||
|
|
Loading…
Add table
Reference in a new issue