diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go index 1e728d4e..5525c185 100644 --- a/contractcourt/chain_arbitrator.go +++ b/contractcourt/chain_arbitrator.go @@ -243,6 +243,7 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel, return chanMachine.ForceClose() }, MarkCommitmentBroadcasted: channel.MarkCommitmentBroadcasted, + MarkChannelClosed: channel.CloseChannel, ChainArbitratorConfig: c.cfg, ChainEvents: chanEvents, } diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 69700f03..8a2403e5 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -94,6 +94,13 @@ type ChannelArbitratorConfig struct { // being broadcast, and we are waiting for the commitment to confirm. MarkCommitmentBroadcasted func() error + // MarkChannelClosed marks the channel closed in the database, with the + // passed close summary. After this method successfully returns we can + // no longer expect to receive chain events for this channel, and must + // be able to recover from a failure without getting the close event + // again. + MarkChannelClosed func(*channeldb.ChannelCloseSummary) error + // 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 diff --git a/contractcourt/channel_arbitrator_test.go b/contractcourt/channel_arbitrator_test.go index 14553398..00240b5f 100644 --- a/contractcourt/channel_arbitrator_test.go +++ b/contractcourt/channel_arbitrator_test.go @@ -137,7 +137,9 @@ func createTestChannelArbitrator(log ArbitratorLog) (*ChannelArbitrator, MarkCommitmentBroadcasted: func() error { return nil }, - + MarkChannelClosed: func(*channeldb.ChannelCloseSummary) error { + return nil + }, ChainArbitratorConfig: chainArbCfg, ChainEvents: chanEvents, }