lnwallet/channel: expose NextLocalHtlcIndex

This commit is contained in:
Conner Fromknecht committed 2018-05-02 01:12:17 -07:00
1 parent 1b6101b0c0
commit cae1d468e7
1 file changed
+6 -3
+6 -3
View File
@@ -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.