lnrpc: add updatenodeannouncement to Peers service

New endpoint for the `Peers` subrpc.
This commit is contained in:
positiveblue
2022-01-02 14:32:14 -08:00
parent d4021c5aca
commit 5ab0cbd433
5 changed files with 781 additions and 16 deletions

View File

@@ -7,9 +7,11 @@
package peersrpc
import (
lnrpc "github.com/lightningnetwork/lnd/lnrpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
@@ -19,25 +21,460 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// UpdateAction is used to determine the kind of action we are referring to.
type UpdateAction int32
const (
// ADD indicates this is an "insertion" kind of action.
UpdateAction_ADD UpdateAction = 0
// REMOVE indicates this is a "deletion" kind of action.
UpdateAction_REMOVE UpdateAction = 1
)
// Enum value maps for UpdateAction.
var (
UpdateAction_name = map[int32]string{
0: "ADD",
1: "REMOVE",
}
UpdateAction_value = map[string]int32{
"ADD": 0,
"REMOVE": 1,
}
)
func (x UpdateAction) Enum() *UpdateAction {
p := new(UpdateAction)
*p = x
return p
}
func (x UpdateAction) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (UpdateAction) Descriptor() protoreflect.EnumDescriptor {
return file_peersrpc_peers_proto_enumTypes[0].Descriptor()
}
func (UpdateAction) Type() protoreflect.EnumType {
return &file_peersrpc_peers_proto_enumTypes[0]
}
func (x UpdateAction) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use UpdateAction.Descriptor instead.
func (UpdateAction) EnumDescriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{0}
}
type FeatureSet int32
const (
//
//SET_INIT identifies features that should be sent in an Init message to
//a remote peer.
FeatureSet_SET_INIT FeatureSet = 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.
FeatureSet_SET_LEGACY_GLOBAL FeatureSet = 1
//
//SET_NODE_ANN identifies features that should be advertised on node
//announcements.
FeatureSet_SET_NODE_ANN FeatureSet = 2
//
//SET_INVOICE identifies features that should be advertised on invoices
//generated by the daemon.
FeatureSet_SET_INVOICE FeatureSet = 3
//
//SET_INVOICE_AMP identifies the features that should be advertised on
//AMP invoices generated by the daemon.
FeatureSet_SET_INVOICE_AMP FeatureSet = 4
)
// Enum value maps for FeatureSet.
var (
FeatureSet_name = map[int32]string{
0: "SET_INIT",
1: "SET_LEGACY_GLOBAL",
2: "SET_NODE_ANN",
3: "SET_INVOICE",
4: "SET_INVOICE_AMP",
}
FeatureSet_value = map[string]int32{
"SET_INIT": 0,
"SET_LEGACY_GLOBAL": 1,
"SET_NODE_ANN": 2,
"SET_INVOICE": 3,
"SET_INVOICE_AMP": 4,
}
)
func (x FeatureSet) Enum() *FeatureSet {
p := new(FeatureSet)
*p = x
return p
}
func (x FeatureSet) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (FeatureSet) Descriptor() protoreflect.EnumDescriptor {
return file_peersrpc_peers_proto_enumTypes[1].Descriptor()
}
func (FeatureSet) Type() protoreflect.EnumType {
return &file_peersrpc_peers_proto_enumTypes[1]
}
func (x FeatureSet) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use FeatureSet.Descriptor instead.
func (FeatureSet) EnumDescriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{1}
}
type UpdateAddressAction struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Determines the kind of action.
Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=peersrpc.UpdateAction" json:"action,omitempty"`
// The address used to apply the update action.
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
}
func (x *UpdateAddressAction) Reset() {
*x = UpdateAddressAction{}
if protoimpl.UnsafeEnabled {
mi := &file_peersrpc_peers_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateAddressAction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateAddressAction) ProtoMessage() {}
func (x *UpdateAddressAction) ProtoReflect() protoreflect.Message {
mi := &file_peersrpc_peers_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateAddressAction.ProtoReflect.Descriptor instead.
func (*UpdateAddressAction) Descriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{0}
}
func (x *UpdateAddressAction) GetAction() UpdateAction {
if x != nil {
return x.Action
}
return UpdateAction_ADD
}
func (x *UpdateAddressAction) GetAddress() string {
if x != nil {
return x.Address
}
return ""
}
type UpdateFeatureAction struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Determines the kind of action.
Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=peersrpc.UpdateAction" json:"action,omitempty"`
// The feature bit used to apply the update action.
FeatureBit lnrpc.FeatureBit `protobuf:"varint,2,opt,name=feature_bit,json=featureBit,proto3,enum=lnrpc.FeatureBit" json:"feature_bit,omitempty"`
}
func (x *UpdateFeatureAction) Reset() {
*x = UpdateFeatureAction{}
if protoimpl.UnsafeEnabled {
mi := &file_peersrpc_peers_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateFeatureAction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateFeatureAction) ProtoMessage() {}
func (x *UpdateFeatureAction) ProtoReflect() protoreflect.Message {
mi := &file_peersrpc_peers_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateFeatureAction.ProtoReflect.Descriptor instead.
func (*UpdateFeatureAction) Descriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{1}
}
func (x *UpdateFeatureAction) GetAction() UpdateAction {
if x != nil {
return x.Action
}
return UpdateAction_ADD
}
func (x *UpdateFeatureAction) GetFeatureBit() lnrpc.FeatureBit {
if x != nil {
return x.FeatureBit
}
return lnrpc.FeatureBit_DATALOSS_PROTECT_REQ
}
type NodeAnnouncementUpdateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Set of changes for the features that the node supports.
FeatureUpdates []*UpdateFeatureAction `protobuf:"bytes,1,rep,name=feature_updates,json=featureUpdates,proto3" json:"feature_updates,omitempty"`
// Color is the node's color in hex code format.
Color string `protobuf:"bytes,2,opt,name=color,proto3" json:"color,omitempty"`
// Alias or nick name of the node.
Alias string `protobuf:"bytes,3,opt,name=alias,proto3" json:"alias,omitempty"`
// Set of changes for the node's known addresses.
AddressUpdates []*UpdateAddressAction `protobuf:"bytes,4,rep,name=address_updates,json=addressUpdates,proto3" json:"address_updates,omitempty"`
}
func (x *NodeAnnouncementUpdateRequest) Reset() {
*x = NodeAnnouncementUpdateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_peersrpc_peers_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeAnnouncementUpdateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeAnnouncementUpdateRequest) ProtoMessage() {}
func (x *NodeAnnouncementUpdateRequest) ProtoReflect() protoreflect.Message {
mi := &file_peersrpc_peers_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NodeAnnouncementUpdateRequest.ProtoReflect.Descriptor instead.
func (*NodeAnnouncementUpdateRequest) Descriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{2}
}
func (x *NodeAnnouncementUpdateRequest) GetFeatureUpdates() []*UpdateFeatureAction {
if x != nil {
return x.FeatureUpdates
}
return nil
}
func (x *NodeAnnouncementUpdateRequest) GetColor() string {
if x != nil {
return x.Color
}
return ""
}
func (x *NodeAnnouncementUpdateRequest) GetAlias() string {
if x != nil {
return x.Alias
}
return ""
}
func (x *NodeAnnouncementUpdateRequest) GetAddressUpdates() []*UpdateAddressAction {
if x != nil {
return x.AddressUpdates
}
return nil
}
type NodeAnnouncementUpdateResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ops []*lnrpc.Op `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops,omitempty"`
}
func (x *NodeAnnouncementUpdateResponse) Reset() {
*x = NodeAnnouncementUpdateResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_peersrpc_peers_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeAnnouncementUpdateResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeAnnouncementUpdateResponse) ProtoMessage() {}
func (x *NodeAnnouncementUpdateResponse) ProtoReflect() protoreflect.Message {
mi := &file_peersrpc_peers_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NodeAnnouncementUpdateResponse.ProtoReflect.Descriptor instead.
func (*NodeAnnouncementUpdateResponse) Descriptor() ([]byte, []int) {
return file_peersrpc_peers_proto_rawDescGZIP(), []int{3}
}
func (x *NodeAnnouncementUpdateResponse) GetOps() []*lnrpc.Op {
if x != nil {
return x.Ops
}
return nil
}
var File_peersrpc_peers_proto protoreflect.FileDescriptor
var file_peersrpc_peers_proto_rawDesc = []byte{
0x0a, 0x14, 0x70, 0x65, 0x65, 0x72, 0x73, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x65, 0x65, 0x72, 0x73, 0x72, 0x70, 0x63,
0x32, 0x07, 0x0a, 0x05, 0x50, 0x65, 0x65, 0x72, 0x73, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e,
0x67, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x6c, 0x6e, 0x64, 0x2f, 0x6c, 0x6e, 0x72,
0x70, 0x63, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x1a, 0x0f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x5f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73,
0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x22, 0x79, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x65, 0x61, 0x74,
0x75, 0x72, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72,
0x73, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x0b, 0x66, 0x65, 0x61,
0x74, 0x75, 0x72, 0x65, 0x5f, 0x62, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11,
0x2e, 0x6c, 0x6e, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x69,
0x74, 0x52, 0x0a, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x69, 0x74, 0x22, 0xdb, 0x01,
0x0a, 0x1d, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x46, 0x0a, 0x0f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73,
0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x14, 0x0a,
0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c,
0x69, 0x61, 0x73, 0x12, 0x46, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70,
0x65, 0x65, 0x72, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x61, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x22, 0x3d, 0x0a, 0x1e, 0x4e,
0x6f, 0x64, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a,
0x03, 0x6f, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6c, 0x6e, 0x72,
0x70, 0x63, 0x2e, 0x4f, 0x70, 0x52, 0x03, 0x6f, 0x70, 0x73, 0x2a, 0x23, 0x0a, 0x0c, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x44,
0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x01, 0x2a,
0x69, 0x0a, 0x0a, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x0c, 0x0a,
0x08, 0x53, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x53,
0x45, 0x54, 0x5f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c,
0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x41,
0x4e, 0x4e, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x56, 0x4f,
0x49, 0x43, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x56,
0x4f, 0x49, 0x43, 0x45, 0x5f, 0x41, 0x4d, 0x50, 0x10, 0x04, 0x32, 0x74, 0x0a, 0x05, 0x50, 0x65,
0x65, 0x72, 0x73, 0x12, 0x6b, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e,
0x70, 0x65, 0x65, 0x72, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x6e, 0x6e,
0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x72, 0x70,
0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c,
0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f,
0x6c, 0x6e, 0x64, 0x2f, 0x6c, 0x6e, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x72,
0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_peersrpc_peers_proto_goTypes = []interface{}{}
var (
file_peersrpc_peers_proto_rawDescOnce sync.Once
file_peersrpc_peers_proto_rawDescData = file_peersrpc_peers_proto_rawDesc
)
func file_peersrpc_peers_proto_rawDescGZIP() []byte {
file_peersrpc_peers_proto_rawDescOnce.Do(func() {
file_peersrpc_peers_proto_rawDescData = protoimpl.X.CompressGZIP(file_peersrpc_peers_proto_rawDescData)
})
return file_peersrpc_peers_proto_rawDescData
}
var file_peersrpc_peers_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_peersrpc_peers_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_peersrpc_peers_proto_goTypes = []interface{}{
(UpdateAction)(0), // 0: peersrpc.UpdateAction
(FeatureSet)(0), // 1: peersrpc.FeatureSet
(*UpdateAddressAction)(nil), // 2: peersrpc.UpdateAddressAction
(*UpdateFeatureAction)(nil), // 3: peersrpc.UpdateFeatureAction
(*NodeAnnouncementUpdateRequest)(nil), // 4: peersrpc.NodeAnnouncementUpdateRequest
(*NodeAnnouncementUpdateResponse)(nil), // 5: peersrpc.NodeAnnouncementUpdateResponse
(lnrpc.FeatureBit)(0), // 6: lnrpc.FeatureBit
(*lnrpc.Op)(nil), // 7: lnrpc.Op
}
var file_peersrpc_peers_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
0, // 0: peersrpc.UpdateAddressAction.action:type_name -> peersrpc.UpdateAction
0, // 1: peersrpc.UpdateFeatureAction.action:type_name -> peersrpc.UpdateAction
6, // 2: peersrpc.UpdateFeatureAction.feature_bit:type_name -> lnrpc.FeatureBit
3, // 3: peersrpc.NodeAnnouncementUpdateRequest.feature_updates:type_name -> peersrpc.UpdateFeatureAction
2, // 4: peersrpc.NodeAnnouncementUpdateRequest.address_updates:type_name -> peersrpc.UpdateAddressAction
7, // 5: peersrpc.NodeAnnouncementUpdateResponse.ops:type_name -> lnrpc.Op
4, // 6: peersrpc.Peers.UpdateNodeAnnouncement:input_type -> peersrpc.NodeAnnouncementUpdateRequest
5, // 7: peersrpc.Peers.UpdateNodeAnnouncement:output_type -> peersrpc.NodeAnnouncementUpdateResponse
7, // [7:8] is the sub-list for method output_type
6, // [6:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_peersrpc_peers_proto_init() }
@@ -45,18 +482,70 @@ func file_peersrpc_peers_proto_init() {
if File_peersrpc_peers_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_peersrpc_peers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateAddressAction); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_peersrpc_peers_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateFeatureAction); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_peersrpc_peers_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeAnnouncementUpdateRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_peersrpc_peers_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeAnnouncementUpdateResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_peersrpc_peers_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumEnums: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_peersrpc_peers_proto_goTypes,
DependencyIndexes: file_peersrpc_peers_proto_depIdxs,
EnumInfos: file_peersrpc_peers_proto_enumTypes,
MessageInfos: file_peersrpc_peers_proto_msgTypes,
}.Build()
File_peersrpc_peers_proto = out.File
file_peersrpc_peers_proto_rawDesc = nil

View File

@@ -0,0 +1,50 @@
// Code generated by falafel 0.9.1. DO NOT EDIT.
// source: peers.proto
// +build js
package peersrpc
import (
"context"
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/protojson"
)
func RegisterPeersJSONCallbacks(registry map[string]func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error))) {
marshaler := &gateway.JSONPb{
MarshalOptions: protojson.MarshalOptions{
UseProtoNames: true,
EmitUnpopulated: true,
},
}
registry["peersrpc.Peers.UpdateNodeAnnouncement"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &NodeAnnouncementUpdateRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewPeersClient(conn)
resp, err := client.UpdateNodeAnnouncement(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
}

View File

@@ -1,5 +1,7 @@
syntax = "proto3";
import "lightning.proto";
package peersrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";
@@ -7,4 +9,86 @@ 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 newtwork.
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;
}

View File

@@ -4,6 +4,11 @@
"title": "peersrpc/peers.proto",
"version": "version not set"
},
"tags": [
{
"name": "Peers"
}
],
"consumes": [
"application/json"
],
@@ -12,6 +17,97 @@
],
"paths": {},
"definitions": {
"lnrpcFeatureBit": {
"type": "string",
"enum": [
"DATALOSS_PROTECT_REQ",
"DATALOSS_PROTECT_OPT",
"INITIAL_ROUING_SYNC",
"UPFRONT_SHUTDOWN_SCRIPT_REQ",
"UPFRONT_SHUTDOWN_SCRIPT_OPT",
"GOSSIP_QUERIES_REQ",
"GOSSIP_QUERIES_OPT",
"TLV_ONION_REQ",
"TLV_ONION_OPT",
"EXT_GOSSIP_QUERIES_REQ",
"EXT_GOSSIP_QUERIES_OPT",
"STATIC_REMOTE_KEY_REQ",
"STATIC_REMOTE_KEY_OPT",
"PAYMENT_ADDR_REQ",
"PAYMENT_ADDR_OPT",
"MPP_REQ",
"MPP_OPT",
"WUMBO_CHANNELS_REQ",
"WUMBO_CHANNELS_OPT",
"ANCHORS_REQ",
"ANCHORS_OPT",
"ANCHORS_ZERO_FEE_HTLC_REQ",
"ANCHORS_ZERO_FEE_HTLC_OPT",
"AMP_REQ",
"AMP_OPT"
],
"default": "DATALOSS_PROTECT_REQ"
},
"lnrpcOp": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"actions": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"peersrpcNodeAnnouncementUpdateResponse": {
"type": "object",
"properties": {
"ops": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcOp"
}
}
}
},
"peersrpcUpdateAction": {
"type": "string",
"enum": [
"ADD",
"REMOVE"
],
"default": "ADD",
"description": "UpdateAction is used to determine the kind of action we are referring to.\n\n - ADD: ADD indicates this is an \"insertion\" kind of action.\n - REMOVE: REMOVE indicates this is a \"deletion\" kind of action."
},
"peersrpcUpdateAddressAction": {
"type": "object",
"properties": {
"action": {
"$ref": "#/definitions/peersrpcUpdateAction",
"description": "Determines the kind of action."
},
"address": {
"type": "string",
"description": "The address used to apply the update action."
}
}
},
"peersrpcUpdateFeatureAction": {
"type": "object",
"properties": {
"action": {
"$ref": "#/definitions/peersrpcUpdateAction",
"description": "Determines the kind of action."
},
"feature_bit": {
"$ref": "#/definitions/lnrpcFeatureBit",
"description": "The feature bit used to apply the update action."
}
}
},
"protobufAny": {
"type": "object",
"properties": {

View File

@@ -3,7 +3,10 @@
package peersrpc
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
@@ -15,6 +18,10 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PeersClient interface {
// lncli: peers updatenodeannouncement
//UpdateNodeAnnouncement allows the caller to update the node parameters
//and broadcasts a new version of the node announcement to its peers.
UpdateNodeAnnouncement(ctx context.Context, in *NodeAnnouncementUpdateRequest, opts ...grpc.CallOption) (*NodeAnnouncementUpdateResponse, error)
}
type peersClient struct {
@@ -25,10 +32,23 @@ func NewPeersClient(cc grpc.ClientConnInterface) PeersClient {
return &peersClient{cc}
}
func (c *peersClient) UpdateNodeAnnouncement(ctx context.Context, in *NodeAnnouncementUpdateRequest, opts ...grpc.CallOption) (*NodeAnnouncementUpdateResponse, error) {
out := new(NodeAnnouncementUpdateResponse)
err := c.cc.Invoke(ctx, "/peersrpc.Peers/UpdateNodeAnnouncement", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PeersServer is the server API for Peers service.
// All implementations must embed UnimplementedPeersServer
// for forward compatibility
type PeersServer interface {
// lncli: peers updatenodeannouncement
//UpdateNodeAnnouncement allows the caller to update the node parameters
//and broadcasts a new version of the node announcement to its peers.
UpdateNodeAnnouncement(context.Context, *NodeAnnouncementUpdateRequest) (*NodeAnnouncementUpdateResponse, error)
mustEmbedUnimplementedPeersServer()
}
@@ -36,6 +56,9 @@ type PeersServer interface {
type UnimplementedPeersServer struct {
}
func (UnimplementedPeersServer) UpdateNodeAnnouncement(context.Context, *NodeAnnouncementUpdateRequest) (*NodeAnnouncementUpdateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeAnnouncement not implemented")
}
func (UnimplementedPeersServer) mustEmbedUnimplementedPeersServer() {}
// UnsafePeersServer may be embedded to opt out of forward compatibility for this service.
@@ -49,13 +72,36 @@ func RegisterPeersServer(s grpc.ServiceRegistrar, srv PeersServer) {
s.RegisterService(&Peers_ServiceDesc, srv)
}
func _Peers_UpdateNodeAnnouncement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NodeAnnouncementUpdateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeersServer).UpdateNodeAnnouncement(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/peersrpc.Peers/UpdateNodeAnnouncement",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeersServer).UpdateNodeAnnouncement(ctx, req.(*NodeAnnouncementUpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
// Peers_ServiceDesc is the grpc.ServiceDesc for Peers service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Peers_ServiceDesc = grpc.ServiceDesc{
ServiceName: "peersrpc.Peers",
HandlerType: (*PeersServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{},
Metadata: "peersrpc/peers.proto",
Methods: []grpc.MethodDesc{
{
MethodName: "UpdateNodeAnnouncement",
Handler: _Peers_UpdateNodeAnnouncement_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "peersrpc/peers.proto",
}