contractcourt/[chain|channel]_arbitrator: define IsPendingClose

This commit is contained in:
Johan T. Halseth 2018-08-21 12:21:16 +02:00
parent 6b24ca0387
commit 1758ad829f
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
3 changed files with 17 additions and 0 deletions

@ -244,6 +244,7 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
},
MarkCommitmentBroadcasted: channel.MarkCommitmentBroadcasted,
MarkChannelClosed: channel.CloseChannel,
IsPendingClose: false,
ChainArbitratorConfig: c.cfg,
ChainEvents: chanEvents,
}
@ -399,6 +400,9 @@ func (c *ChainArbitrator) Start() error {
BlockEpochs: blockEpoch,
ChainArbitratorConfig: c.cfg,
ChainEvents: &ChainEventSubscription{},
IsPendingClose: true,
ClosingHeight: closeChanInfo.CloseHeight,
CloseType: closeChanInfo.CloseType,
}
chanLog, err := newBoltArbitratorLog(
c.chanSource.DB, arbCfg, c.cfg.ChainHash, chanPoint,

@ -101,6 +101,18 @@ type ChannelArbitratorConfig struct {
// again.
MarkChannelClosed func(*channeldb.ChannelCloseSummary) error
// IsPendingClose is a boolean indicating whether the channel is marked
// as pending close in the database.
IsPendingClose bool
// ClosingHeight is the height at which the channel was closed. Note
// that this value is only valid if IsPendingClose is true.
ClosingHeight uint32
// CloseType is the type of the close event in case IsPendingClose is
// true. Otherwise this value is unset.
CloseType channeldb.ClosureType
// MarkChannelResolved is a function closure that serves to mark a
// channel as "fully resolved". A channel itself can be considered
// fully resolved once all active contracts have individually been

@ -149,6 +149,7 @@ func createTestChannelArbitrator(log ArbitratorLog) (*ChannelArbitrator,
MarkChannelClosed: func(*channeldb.ChannelCloseSummary) error {
return nil
},
IsPendingClose: false,
ChainArbitratorConfig: chainArbCfg,
ChainEvents: chanEvents,
}