channeldb: added isPending flag and queries

In order to facilitate persistence during the funding process, added
the isPending flag to channels so that when the daemon restarts, we can
properly re-initialize the chain notifier and update the state of
channels that were going through the funding process.
This commit is contained in:
bryanvu
2017-01-22 23:31:01 -08:00
committed by Olaoluwa Osuntokun
parent 9034f85b88
commit 3e02ea11ef
7 changed files with 239 additions and 23 deletions

View File

@ -631,7 +631,11 @@ func (r *rpcServer) GetInfo(ctx context.Context,
activeChannels += uint32(len(serverPeer.ChannelSnapshots()))
}
pendingChannels := r.server.fundingMgr.NumPendingChannels()
pendingChannels, err := r.server.fundingMgr.NumPendingChannels()
if err != nil {
return nil, err
}
idPub := r.server.identityPriv.PubKey().SerializeCompressed()
bestHash, bestHeight, err := r.server.bio.GetBestBlock()
@ -760,7 +764,10 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
var pendingChannels []*lnrpc.PendingChannelResponse_PendingChannel
if includeOpen {
pendingOpenChans := r.server.fundingMgr.PendingChannels()
pendingOpenChans, err := r.server.fundingMgr.PendingChannels()
if err != nil {
return nil, err
}
for _, pendingOpen := range pendingOpenChans {
channelPointStr := "<non initialized yet>"
if pendingOpen.channelPoint != nil {