funding+server.go: modify notifications to pass through server

This modifies the various channelnotifier notification functions
to instead hit the server and then call the notification routine.
This allows us to accurately modify the server's maps.
This commit is contained in:
Eugene Siegel
2025-01-16 10:43:37 -05:00
parent 6eb746fbba
commit 68ec766b61
3 changed files with 62 additions and 10 deletions

View File

@@ -231,17 +231,30 @@ type mockChanEvent struct {
pendingOpenEvent chan channelnotifier.PendingOpenChannelEvent
}
func (m *mockChanEvent) NotifyOpenChannelEvent(outpoint wire.OutPoint) {
func (m *mockChanEvent) NotifyOpenChannelEvent(outpoint wire.OutPoint,
remotePub *btcec.PublicKey) error {
m.openEvent <- outpoint
return nil
}
func (m *mockChanEvent) NotifyPendingOpenChannelEvent(outpoint wire.OutPoint,
pendingChannel *channeldb.OpenChannel) {
pendingChannel *channeldb.OpenChannel,
remotePub *btcec.PublicKey) error {
m.pendingOpenEvent <- channelnotifier.PendingOpenChannelEvent{
ChannelPoint: &outpoint,
PendingChannel: pendingChannel,
}
return nil
}
func (m *mockChanEvent) NotifyFundingTimeout(outpoint wire.OutPoint,
remotePub *btcec.PublicKey) error {
return nil
}
// mockZeroConfAcceptor always accepts the channel open request for zero-conf
@@ -550,6 +563,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
NotifyOpenChannelEvent: evt.NotifyOpenChannelEvent,
OpenChannelPredicate: chainedAcceptor,
NotifyPendingOpenChannelEvent: evt.NotifyPendingOpenChannelEvent,
NotifyFundingTimeout: evt.NotifyFundingTimeout,
DeleteAliasEdge: func(scid lnwire.ShortChannelID) (
*models.ChannelEdgePolicy, error) {