lnwallet/channel: expose NextLocalHtlcIndex
This commit is contained in:
parent
1b6101b0c0
commit
cae1d468e7
@ -5885,12 +5885,15 @@ func (lc *LightningChannel) LocalChanReserve() btcutil.Amount {
|
|||||||
return lc.localChanCfg.ChanReserve
|
return lc.localChanCfg.ChanReserve
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalHtlcIndex returns the next local htlc index to be allocated.
|
// NextLocalHtlcIndex returns the next unallocated local htlc index. To ensure
|
||||||
func (lc *LightningChannel) LocalHtlcIndex() uint64 {
|
// this always returns the next index that has been not been allocated, this
|
||||||
|
// will first try to examine any pending commitments, before falling back to the
|
||||||
|
// last locked-in local commitment.
|
||||||
|
func (lc *LightningChannel) NextLocalHtlcIndex() (uint64, error) {
|
||||||
lc.RLock()
|
lc.RLock()
|
||||||
defer lc.RUnlock()
|
defer lc.RUnlock()
|
||||||
|
|
||||||
return lc.channelState.LocalCommitment.LocalHtlcIndex
|
return lc.channelState.NextLocalHtlcIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteCommitHeight returns the commitment height of the remote chain.
|
// RemoteCommitHeight returns the commitment height of the remote chain.
|
||||||
|
Loading…
Reference in New Issue
Block a user