syntax = "proto3";

package peersrpc;

import "lightning.proto";

option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";

// Peers is a service that can be used to get information and interact
// with the other nodes of the network.
service Peers {
    /* lncli: peers updatenodeannouncement
    UpdateNodeAnnouncement allows the caller to update the node parameters
    and broadcasts a new version of the node announcement to its peers.
    */
    rpc UpdateNodeAnnouncement (NodeAnnouncementUpdateRequest)
        returns (NodeAnnouncementUpdateResponse);
}

// UpdateAction is used to determine the kind of action we are referring to.
enum UpdateAction {
    // ADD indicates this is an "insertion" kind of action.
    ADD = 0;

    // REMOVE indicates this is a "deletion" kind of action.
    REMOVE = 1;
}

enum FeatureSet {
    /*
    SET_INIT identifies features that should be sent in an Init message to
    a remote peer.
    */
    SET_INIT = 0;

    /*
    SET_LEGACY_GLOBAL identifies features that should be set in the legacy
    GlobalFeatures field of an Init message, which maintains backwards
    compatibility with nodes that haven't implemented flat features.
    */
    SET_LEGACY_GLOBAL = 1;

    /*
    SET_NODE_ANN identifies features that should be advertised on node
    announcements.
    */
    SET_NODE_ANN = 2;

    /*
    SET_INVOICE identifies features that should be advertised on invoices
    generated by the daemon.
    */
    SET_INVOICE = 3;

    /*
    SET_INVOICE_AMP identifies the features that should be advertised on
    AMP invoices generated by the daemon.
    */
    SET_INVOICE_AMP = 4;
}

message UpdateAddressAction {
    // Determines the kind of action.
    UpdateAction action = 1;

    // The address used to apply the update action.
    string address = 2;
}

message UpdateFeatureAction {
    // Determines the kind of action.
    UpdateAction action = 1;

    // The feature bit used to apply the update action.
    lnrpc.FeatureBit feature_bit = 2;
}

message NodeAnnouncementUpdateRequest {
    // Set of changes for the features that the node supports.
    repeated UpdateFeatureAction feature_updates = 1;

    // Color is the node's color in hex code format.
    string color = 2;

    // Alias or nick name of the node.
    string alias = 3;

    // Set of changes for the node's known addresses.
    repeated UpdateAddressAction address_updates = 4;
}

message NodeAnnouncementUpdateResponse {
    repeated lnrpc.Op ops = 1;
}