@@ -2,15 +2,8 @@ use crate::logger::{log_error, log_info, FilesystemLogger, Logger};
2
2
use crate :: types:: { GossipSync , NetworkGraph , P2PGossipSync , RapidGossipSync } ;
3
3
use crate :: Error ;
4
4
5
- use lightning:: events:: MessageSendEventsProvider ;
6
- use lightning:: ln:: features:: { InitFeatures , NodeFeatures } ;
7
- use lightning:: ln:: msgs as ldk_msgs;
8
- use lightning:: ln:: msgs:: RoutingMessageHandler ;
9
- use lightning:: routing:: gossip:: NodeId ;
10
5
use lightning:: routing:: utxo:: UtxoLookup ;
11
6
12
- use bitcoin:: secp256k1:: PublicKey ;
13
-
14
7
use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
15
8
use std:: sync:: Arc ;
16
9
@@ -95,150 +88,3 @@ impl GossipSource {
95
88
}
96
89
}
97
90
}
98
-
99
- impl MessageSendEventsProvider for GossipSource {
100
- fn get_and_clear_pending_msg_events ( & self ) -> Vec < lightning:: events:: MessageSendEvent > {
101
- match self {
102
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
103
- gossip_sync. get_and_clear_pending_msg_events ( )
104
- }
105
- GossipSource :: RapidGossipSync { .. } => Vec :: new ( ) ,
106
- }
107
- }
108
- }
109
-
110
- impl RoutingMessageHandler for GossipSource {
111
- fn handle_node_announcement (
112
- & self , msg : & ldk_msgs:: NodeAnnouncement ,
113
- ) -> Result < bool , ldk_msgs:: LightningError > {
114
- match self {
115
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
116
- gossip_sync. handle_node_announcement ( msg)
117
- }
118
- GossipSource :: RapidGossipSync { .. } => Ok ( false ) ,
119
- }
120
- }
121
-
122
- fn handle_channel_announcement (
123
- & self , msg : & ldk_msgs:: ChannelAnnouncement ,
124
- ) -> Result < bool , ldk_msgs:: LightningError > {
125
- match self {
126
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
127
- gossip_sync. handle_channel_announcement ( msg)
128
- }
129
- GossipSource :: RapidGossipSync { .. } => Ok ( false ) ,
130
- }
131
- }
132
-
133
- fn handle_channel_update (
134
- & self , msg : & ldk_msgs:: ChannelUpdate ,
135
- ) -> Result < bool , ldk_msgs:: LightningError > {
136
- match self {
137
- GossipSource :: P2PNetwork { gossip_sync, .. } => gossip_sync. handle_channel_update ( msg) ,
138
- GossipSource :: RapidGossipSync { .. } => Ok ( false ) ,
139
- }
140
- }
141
-
142
- fn get_next_channel_announcement (
143
- & self , starting_point : u64 ,
144
- ) -> Option < (
145
- ldk_msgs:: ChannelAnnouncement ,
146
- Option < ldk_msgs:: ChannelUpdate > ,
147
- Option < ldk_msgs:: ChannelUpdate > ,
148
- ) > {
149
- match self {
150
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
151
- gossip_sync. get_next_channel_announcement ( starting_point)
152
- }
153
- GossipSource :: RapidGossipSync { .. } => None ,
154
- }
155
- }
156
-
157
- fn get_next_node_announcement (
158
- & self , starting_point : Option < & NodeId > ,
159
- ) -> Option < ldk_msgs:: NodeAnnouncement > {
160
- match self {
161
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
162
- gossip_sync. get_next_node_announcement ( starting_point)
163
- }
164
- GossipSource :: RapidGossipSync { .. } => None ,
165
- }
166
- }
167
-
168
- fn peer_connected (
169
- & self , their_node_id : & PublicKey , init : & ldk_msgs:: Init , inbound : bool ,
170
- ) -> Result < ( ) , ( ) > {
171
- match self {
172
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
173
- gossip_sync. peer_connected ( their_node_id, init, inbound)
174
- }
175
- GossipSource :: RapidGossipSync { .. } => Ok ( ( ) ) ,
176
- }
177
- }
178
-
179
- fn handle_reply_channel_range (
180
- & self , their_node_id : & PublicKey , msg : ldk_msgs:: ReplyChannelRange ,
181
- ) -> Result < ( ) , ldk_msgs:: LightningError > {
182
- match self {
183
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
184
- gossip_sync. handle_reply_channel_range ( their_node_id, msg)
185
- }
186
- GossipSource :: RapidGossipSync { .. } => Ok ( ( ) ) ,
187
- }
188
- }
189
-
190
- fn handle_reply_short_channel_ids_end (
191
- & self , their_node_id : & PublicKey , msg : ldk_msgs:: ReplyShortChannelIdsEnd ,
192
- ) -> Result < ( ) , ldk_msgs:: LightningError > {
193
- match self {
194
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
195
- gossip_sync. handle_reply_short_channel_ids_end ( their_node_id, msg)
196
- }
197
- GossipSource :: RapidGossipSync { .. } => Ok ( ( ) ) ,
198
- }
199
- }
200
-
201
- fn handle_query_channel_range (
202
- & self , their_node_id : & PublicKey , msg : ldk_msgs:: QueryChannelRange ,
203
- ) -> Result < ( ) , ldk_msgs:: LightningError > {
204
- match self {
205
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
206
- gossip_sync. handle_query_channel_range ( their_node_id, msg)
207
- }
208
- GossipSource :: RapidGossipSync { .. } => Ok ( ( ) ) ,
209
- }
210
- }
211
-
212
- fn handle_query_short_channel_ids (
213
- & self , their_node_id : & PublicKey , msg : ldk_msgs:: QueryShortChannelIds ,
214
- ) -> Result < ( ) , ldk_msgs:: LightningError > {
215
- match self {
216
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
217
- gossip_sync. handle_query_short_channel_ids ( their_node_id, msg)
218
- }
219
- GossipSource :: RapidGossipSync { .. } => Ok ( ( ) ) ,
220
- }
221
- }
222
-
223
- fn provided_node_features ( & self ) -> NodeFeatures {
224
- match self {
225
- GossipSource :: P2PNetwork { gossip_sync, .. } => gossip_sync. provided_node_features ( ) ,
226
- GossipSource :: RapidGossipSync { .. } => NodeFeatures :: empty ( ) ,
227
- }
228
- }
229
- fn provided_init_features ( & self , their_node_id : & PublicKey ) -> InitFeatures {
230
- match self {
231
- GossipSource :: P2PNetwork { gossip_sync, .. } => {
232
- gossip_sync. provided_init_features ( their_node_id)
233
- }
234
- GossipSource :: RapidGossipSync { .. } => InitFeatures :: empty ( ) ,
235
- }
236
- }
237
-
238
- fn processing_queue_high ( & self ) -> bool {
239
- match self {
240
- GossipSource :: P2PNetwork { gossip_sync, .. } => gossip_sync. processing_queue_high ( ) ,
241
- GossipSource :: RapidGossipSync { .. } => false ,
242
- }
243
- }
244
- }
0 commit comments