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 authored and Olaoluwa Osuntokun committed 2017-02-24 11:37:33 -08:00
1 parent 9034f85b88
commit 3e02ea11ef
7 files changed
+239 -23

No files matched your search

+2 -2
View File
@@ -1066,7 +1066,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
// which will be used for the lifetime of this channel.
// TODO(roasbeef): revisit faul-tolerance of this flow
nodeAddr := res.nodeAddr
if err := res.partialState.FullSyncWithAddr(nodeAddr); err != nil {
if err := res.partialState.SyncPending(nodeAddr); err != nil {
msg.err <- err
return
}
@@ -1220,7 +1220,7 @@ func (l *LightningWallet) handleChannelOpen(req *channelOpenMsg) {
// Add the complete funding transaction to the DB, in it's open bucket
// which will be used for the lifetime of this channel.
if err := res.partialState.FullSyncWithAddr(res.nodeAddr); err != nil {
if err := res.partialState.SyncPending(res.nodeAddr); err != nil {
req.err <- err
res.chanOpen <- nil
return