Skip to content

Commit c9c396d

Browse files
committed
autopilotserver: update to send linked session info
Update the autopilot server client to send the new session linking fields if they are provided. Currently, they are not yet provided.
1 parent 9098253 commit c9c396d

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

autopilotserver/client.go

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,12 @@ func (c *Client) ListFeatures(ctx context.Context) (map[string]*Feature,
376376
//
377377
// Note: this is part of the Autopilot interface.
378378
func (c *Client) RegisterSession(ctx context.Context, pubKey *btcec.PublicKey,
379-
mailboxAddr string, devServer bool, featureConf map[string][]byte) (
380-
*btcec.PublicKey, error) {
379+
mailboxAddr string, devServer bool, featureConf map[string][]byte,
380+
groupKey *btcec.PublicKey, linkSig []byte) (*btcec.PublicKey, error) {
381381

382382
remotePub, err := c.registerSession(
383383
ctx, pubKey, mailboxAddr, devServer, featureConf,
384+
groupKey, linkSig,
384385
)
385386
if err != nil {
386387
log.Errorf("unsuccessful registration of session %x",
@@ -425,23 +426,31 @@ func (c *Client) trackClient(pubKey *btcec.PublicKey) {
425426
// registerSession attempts to register a session with the given local static
426427
// public key with the autopilot server.
427428
func (c *Client) registerSession(ctx context.Context, pubKey *btcec.PublicKey,
428-
mailboxAddr string, devServer bool,
429-
featureConfig map[string][]byte) (*btcec.PublicKey, error) {
429+
mailboxAddr string, devServer bool, featureConfig map[string][]byte,
430+
groupLocalPub *btcec.PublicKey, linkSig []byte) (*btcec.PublicKey,
431+
error) {
430432

431433
client, cleanup, err := c.getClientConn()
432434
if err != nil {
433435
return nil, err
434436
}
435437
defer cleanup()
436438

439+
var groupKey []byte
440+
if groupLocalPub != nil {
441+
groupKey = groupLocalPub.SerializeCompressed()
442+
}
443+
437444
resp, err := client.RegisterSession(
438445
ctx, &autopilotserverrpc.RegisterSessionRequest{
439-
ResponderPubKey: pubKey.SerializeCompressed(),
440-
MailboxAddr: mailboxAddr,
441-
DevServer: devServer,
442-
FeatureConfigs: featureConfig,
443-
LitVersion: marshalVersion(c.cfg.LitVersion),
444-
LndVersion: marshalVersion(c.cfg.LndVersion),
446+
ResponderPubKey: pubKey.SerializeCompressed(),
447+
MailboxAddr: mailboxAddr,
448+
DevServer: devServer,
449+
FeatureConfigs: featureConfig,
450+
LitVersion: marshalVersion(c.cfg.LitVersion),
451+
LndVersion: marshalVersion(c.cfg.LndVersion),
452+
GroupResponderKey: groupKey,
453+
GroupResponderSig: linkSig,
445454
},
446455
)
447456
if err != nil {

autopilotserver/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestAutopilotClient(t *testing.T) {
4545
require.ErrorContains(t, err, "no such client")
4646

4747
// Register the client.
48-
_, err = client.RegisterSession(ctx, pubKey, "", false, nil)
48+
_, err = client.RegisterSession(ctx, pubKey, "", false, nil, nil, nil)
4949
require.NoError(t, err)
5050

5151
// Assert that the server sees the new client and has it in the Active

autopilotserver/interface.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ type Autopilot interface {
2929
// remains active.
3030
RegisterSession(ctx context.Context, pubKey *btcec.PublicKey,
3131
mailboxAddr string, devServer bool,
32-
featureConf map[string][]byte) (*btcec.PublicKey, error)
32+
featureConf map[string][]byte, prevLocal *btcec.PublicKey,
33+
linkSig []byte) (*btcec.PublicKey, error)
3334

3435
// ActivateSession attempts to inform the autopilot server that the
3536
// given session is still active. After this is called, the autopilot

session_rpcserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ func (s *sessionRpcServer) AddAutopilotSession(ctx context.Context,
10271027
// Attempt to register the session with the Autopilot server.
10281028
remoteKey, err := s.cfg.autopilot.RegisterSession(
10291029
ctx, sess.LocalPublicKey, sess.ServerAddr, sess.DevServer,
1030-
featureConfig,
1030+
featureConfig, nil, nil,
10311031
)
10321032
if err != nil {
10331033
return nil, fmt.Errorf("error registering session with "+

0 commit comments

Comments
 (0)