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:
1 parent
9034f85b88
commit
3e02ea11ef
7 files changed
+239
-23
No files matched your search
@@ -204,6 +204,7 @@ func NewChannelReservation(capacity, fundingAmt btcutil.Amount, minFeeRate btcut
|
||||
partialState: &channeldb.OpenChannel{
|
||||
Capacity: capacity,
|
||||
IsInitiator: initiator,
|
||||
IsPending: true,
|
||||
ChanType: chanType,
|
||||
OurBalance: ourBalance,
|
||||
TheirBalance: theirBalance,
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user