mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 15:13:22 +02:00
peer+chancloser: tryLinkShutdown during cooperative close process
Adds a new Brontide struct method tryLinkShutdown that attempts to fetch the target link and calls ShutdownIfChannelClean on it. This allows the coop close process to guarantee atomicity of the underlying channel state. Also removes the UnregisterChannel method from the chancloser's config as the link is shut down before the chancloser is created.
This commit is contained in:
@@ -380,7 +380,9 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
|
||||
// mockMessageSwitch is a mock implementation of the messageSwitch interface
|
||||
// used for testing without relying on a *htlcswitch.Switch in unit tests.
|
||||
type mockMessageSwitch struct{}
|
||||
type mockMessageSwitch struct {
|
||||
links []htlcswitch.ChannelUpdateHandler
|
||||
}
|
||||
|
||||
// BestHeight currently returns a dummy value.
|
||||
func (m *mockMessageSwitch) BestHeight() uint32 {
|
||||
@@ -402,11 +404,11 @@ func (m *mockMessageSwitch) CreateAndAddLink(cfg htlcswitch.ChannelLinkConfig,
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLinksByInterface currently returns dummy values.
|
||||
// GetLinksByInterface returns the active links.
|
||||
func (m *mockMessageSwitch) GetLinksByInterface(pub [33]byte) (
|
||||
[]htlcswitch.ChannelUpdateHandler, error) {
|
||||
|
||||
return nil, nil
|
||||
return m.links, nil
|
||||
}
|
||||
|
||||
// mockUpdateHandler is a mock implementation of the ChannelUpdateHandler
|
||||
|
Reference in New Issue
Block a user