lnwallet: add IsInitiator and CommitFeeRate methods to LightningChannel

This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 22:02:55 -06:00
parent 1b716e6c87
commit 5a1a3c7277
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -5023,8 +5023,27 @@ func (lc *LightningChannel) CalcFee(feeRate uint64) uint64 {
// RemoteNextRevocation returns the channelState's RemoteNextRevocation.
func (lc *LightningChannel) RemoteNextRevocation() *btcec.PublicKey {
lc.Lock()
defer lc.Unlock()
lc.RLock()
defer lc.RUnlock()
return lc.channelState.RemoteNextRevocation
}
// IsInitiator returns true if we were the ones that initiated the funding
// workflow which led to the creation of this channel. Otherwise, it returns
// false.
func (lc *LightningChannel) IsInitiator() bool {
lc.RLock()
defer lc.RUnlock()
return lc.channelState.IsInitiator
}
// CommitFeeRate returns the current fee rate of the commitment transaction in
// units of sat-per-kw.
func (lc *LightningChannel) CommitFeeRate() btcutil.Amount {
lc.RLock()
defer lc.RUnlock()
return lc.channelState.LocalCommitment.FeePerKw
}