funding: add method IsPendingChannel

This commit is contained in:
Johan T. Halseth 2018-02-28 23:35:03 +01:00
parent 7252dbd934
commit f1f1a38663
No known key found for this signature in database
GPG key ID: 15BAADA29DA20D26

View file

@ -2639,6 +2639,22 @@ func (f *fundingManager) getReservationCtx(peerKey *btcec.PublicKey,
return resCtx, nil return resCtx, nil
} }
// IsPendingChannel returns a boolean indicating whether the channel identified
// by the pendingChanID and given peer is pending, meaning it is in the process
// of being funded. After the funding transaction has been confirmed, the
// channel will receive a new, permanent channel ID, and will no longer be
// considered pending.
func (f *fundingManager) IsPendingChannel(pendingChanID [32]byte,
peerAddress *lnwire.NetAddress) bool {
peerIDKey := newSerializedKey(peerAddress.IdentityKey)
f.resMtx.RLock()
_, ok := f.activeReservations[peerIDKey][pendingChanID]
f.resMtx.RUnlock()
return ok
}
func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey { func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
return &btcec.PublicKey{ return &btcec.PublicKey{
Curve: btcec.S256(), Curve: btcec.S256(),