@@ -1284,3 +1284,91 @@ func (s *Server) NotifyBroadcast(req *sweep.BumpRequest,
1284
1284
1285
1285
return s .cfg .AuxSweeper .NotifyBroadcast (req , tx , fee , outpointToTxIndex )
1286
1286
}
1287
+
1288
+ // GetInitFeatures is called when sending an init message to a peer. It returns
1289
+ // custom feature bits to include in the init message TLVs. The implementation
1290
+ // can decide which features to advertise based on the peer's identity.
1291
+ func (s * Server ) GetInitFeatures (peer route.Vertex ) (tlv.Blob , error ) {
1292
+ srvrLog .Tracef ("GetInitFeatures called, peer=%s" , peer )
1293
+
1294
+ if err := s .waitForReady (); err != nil {
1295
+ return nil , err
1296
+ }
1297
+
1298
+ // There's no need to wait for the server to be ready, this action acts
1299
+ // only within the aux chan negotiator instance.
1300
+ return s .cfg .AuxChanNegotiator .GetInitFeatures (peer )
1301
+ }
1302
+
1303
+ // ProcessInitFeatures handles received init feature TLVs from a peer. The
1304
+ // implementation can store state internally to affect future channel operations
1305
+ // with this peer.
1306
+ func (s * Server ) ProcessInitFeatures (peer route.Vertex ,
1307
+ features tlv.Blob ) error {
1308
+
1309
+ srvrLog .Tracef ("ProcessInitFeatures called, peer=%s" , peer )
1310
+
1311
+ if err := s .waitForReady (); err != nil {
1312
+ return err
1313
+ }
1314
+
1315
+ // There's no need to wait for the server to be ready, this action acts
1316
+ // only within the aux chan negotiator instance.
1317
+ return s .cfg .AuxChanNegotiator .ProcessInitFeatures (peer , features )
1318
+ }
1319
+
1320
+ // GetReestablishFeatures is called when sending a channel_reestablish message.
1321
+ // It returns feature bits based on the specific channel identified by its
1322
+ // funding outpoint and aux channel blob.
1323
+ func (s * Server ) GetReestablishFeatures (cid lnwire.ChannelID ,
1324
+ auxChanBlob tlv.Blob ) (tlv.Blob , error ) {
1325
+
1326
+ srvrLog .Tracef ("GetReestablishFeatures called, cid=%s" , cid .String ())
1327
+
1328
+ if err := s .waitForReady (); err != nil {
1329
+ return nil , err
1330
+ }
1331
+
1332
+ // There's no need to wait for the server to be ready, this action acts
1333
+ // only within the aux chan negotiator instance.
1334
+ return s .cfg .AuxChanNegotiator .GetReestablishFeatures (
1335
+ cid , auxChanBlob ,
1336
+ )
1337
+ }
1338
+
1339
+ // ProcessReestablishFeatures handles received channel_reestablish feature TLVs.
1340
+ // This is a blocking call - the channel link will wait for this method to
1341
+ // complete before continuing channel operations. The implementation can modify
1342
+ // aux channel behavior based on the negotiated features.
1343
+ func (s * Server ) ProcessReestablishFeatures (cid lnwire.ChannelID ,
1344
+ features tlv.Blob , auxChanBlob tlv.Blob ) error {
1345
+
1346
+ srvrLog .Tracef ("ProcessReestablishFeatures called, cid=%s" ,
1347
+ cid .String ())
1348
+
1349
+ if err := s .waitForReady (); err != nil {
1350
+ return err
1351
+ }
1352
+
1353
+ // There's no need to wait for the server to be ready, this action acts
1354
+ // only within the aux chan negotiator instance.
1355
+ return s .cfg .AuxChanNegotiator .ProcessReestablishFeatures (
1356
+ cid , features , auxChanBlob ,
1357
+ )
1358
+ }
1359
+
1360
+ // ProcessChannelReady handles the event of marking a channel identified by its
1361
+ // channel ID as ready to use. We also provide the peer the channel was
1362
+ // established with.
1363
+ func (s * Server ) ProcessChannelReady (cid lnwire.ChannelID , peer route.Vertex ) {
1364
+ srvrLog .Tracef ("ProcessChannelReady called, cid=%s, peer=%s" , cid , peer )
1365
+
1366
+ if err := s .waitForReady (); err != nil {
1367
+ srvrLog .Errorf ("ProcessChannelReady got error while waiting " +
1368
+ "for server ready" )
1369
+
1370
+ return
1371
+ }
1372
+
1373
+ s .cfg .AuxChanNegotiator .ProcessChannelReady (cid , peer )
1374
+ }
0 commit comments