mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 22:10:27 +02:00
server+contractcourt: hand-off BreachCloseInfo to channel arbitrator
This also changes the chain_watcher and breacharbiter handoff. The new logic ensures that the channel is only marked as pending closed when the channel arbitrator has persisted the resolutions and commit set.
This commit is contained in:
13
server.go
13
server.go
@ -1088,8 +1088,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
},
|
||||
IsOurAddress: cc.Wallet.IsOurAddress,
|
||||
ContractBreach: func(chanPoint wire.OutPoint,
|
||||
breachRet *lnwallet.BreachRetribution,
|
||||
markClosed func() error) error {
|
||||
breachRet *lnwallet.BreachRetribution) error {
|
||||
|
||||
// processACK will handle the breachArbiter ACKing the
|
||||
// event.
|
||||
@ -1101,8 +1100,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
}
|
||||
|
||||
// If the breachArbiter successfully handled
|
||||
// the event, we can mark the channel closed.
|
||||
finalErr <- markClosed()
|
||||
// the event, we can signal that the handoff
|
||||
// was successful.
|
||||
finalErr <- nil
|
||||
}
|
||||
|
||||
event := &contractcourt.ContractBreachEvent{
|
||||
@ -1118,9 +1118,8 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
return ErrServerShuttingDown
|
||||
}
|
||||
|
||||
// We'll wait for a final error to be available, either
|
||||
// from the breachArbiter or from our markClosed
|
||||
// function closure.
|
||||
// We'll wait for a final error to be available from
|
||||
// the breachArbiter.
|
||||
select {
|
||||
case err := <-finalErr:
|
||||
return err
|
||||
|
Reference in New Issue
Block a user