From 24e5897e91d93e1b32dae4303c11e759e285bc4f Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen Date: Wed, 19 Apr 2023 17:15:04 +0100 Subject: [PATCH 1/5] mod: bumped neutrino package Signed-off-by: Ononiwu Maureen --- go.mod | 2 ++ go.sum | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8d06839328..3f54c59cb3 100644 --- a/go.mod +++ b/go.mod @@ -208,3 +208,5 @@ replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-d go 1.21.4 retract v0.0.2 + +replace github.com/lightninglabs/neutrino => github.com/lightninglabs/neutrino v0.16.1-0.20240523142153-1ea6f5238577 diff --git a/go.sum b/go.sum index 2f83baf01b..17b235ea58 100644 --- a/go.sum +++ b/go.sum @@ -436,8 +436,8 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= -github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd h1:D8aRocHpoCv43hL8egXEMYyPmyOiefFHZ66338KQB2s= -github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= +github.com/lightninglabs/neutrino v0.16.1-0.20240523142153-1ea6f5238577 h1:5snpM/xWzU9m6QS0WR2ijKlC0dcDVHn/aAE5ztwLE+Q= +github.com/lightninglabs/neutrino v0.16.1-0.20240523142153-1ea6f5238577/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g= github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY= From 35c3437e99176f9ae9f6a4990b275cd737a69627 Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen Date: Wed, 19 Apr 2023 17:09:09 +0100 Subject: [PATCH 2/5] lnrpc: UnbanPeer RPC added to neutrino.proto Signed-off-by: Ononiwu Maureen --- lnrpc/neutrinorpc/neutrino.pb.go | 263 ++++++++++++++++++----- lnrpc/neutrinorpc/neutrino.pb.gw.go | 81 +++++++ lnrpc/neutrinorpc/neutrino.proto | 19 ++ lnrpc/neutrinorpc/neutrino.swagger.json | 55 +++++ lnrpc/neutrinorpc/neutrino.yaml | 3 + lnrpc/neutrinorpc/neutrino_grpc.pb.go | 38 ++++ lnrpc/neutrinorpc/neutrinokit.pb.json.go | 25 +++ 7 files changed, 426 insertions(+), 58 deletions(-) diff --git a/lnrpc/neutrinorpc/neutrino.pb.go b/lnrpc/neutrinorpc/neutrino.pb.go index 0879e22a5c..5a5ea719ec 100644 --- a/lnrpc/neutrinorpc/neutrino.pb.go +++ b/lnrpc/neutrinorpc/neutrino.pb.go @@ -1054,6 +1054,112 @@ func (x *GetBlockHashResponse) GetHash() string { return "" } +type UnbanPeerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the peer to be unbanned. + PeerAddress string `protobuf:"bytes,1,opt,name=peer_address,json=peerAddress,proto3" json:"peer_address,omitempty"` + // Indicates if the peer to be unbanned should be connected as a + // permanent peer. + PermConnect bool `protobuf:"varint,2,opt,name=perm_connect,json=permConnect,proto3" json:"perm_connect,omitempty"` +} + +func (x *UnbanPeerRequest) Reset() { + *x = UnbanPeerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_neutrinorpc_neutrino_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnbanPeerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnbanPeerRequest) ProtoMessage() {} + +func (x *UnbanPeerRequest) ProtoReflect() protoreflect.Message { + mi := &file_neutrinorpc_neutrino_proto_msgTypes[16] + 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 UnbanPeerRequest.ProtoReflect.Descriptor instead. +func (*UnbanPeerRequest) Descriptor() ([]byte, []int) { + return file_neutrinorpc_neutrino_proto_rawDescGZIP(), []int{16} +} + +func (x *UnbanPeerRequest) GetPeerAddress() string { + if x != nil { + return x.PeerAddress + } + return "" +} + +func (x *UnbanPeerRequest) GetPermConnect() bool { + if x != nil { + return x.PermConnect + } + return false +} + +type UnbanPeerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The status of the UnbanPeer operation. + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *UnbanPeerResponse) Reset() { + *x = UnbanPeerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_neutrinorpc_neutrino_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnbanPeerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnbanPeerResponse) ProtoMessage() {} + +func (x *UnbanPeerResponse) ProtoReflect() protoreflect.Message { + mi := &file_neutrinorpc_neutrino_proto_msgTypes[17] + 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 UnbanPeerResponse.ProtoReflect.Descriptor instead. +func (*UnbanPeerResponse) Descriptor() ([]byte, []int) { + return file_neutrinorpc_neutrino_proto_rawDescGZIP(), []int{17} +} + +func (x *UnbanPeerResponse) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + var File_neutrinorpc_neutrino_proto protoreflect.FileDescriptor var file_neutrinorpc_neutrino_proto_rawDesc = []byte{ @@ -1156,52 +1262,65 @@ var file_neutrinorpc_neutrino_proto_rawDesc = []byte{ 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x2a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x87, 0x05, - 0x0a, 0x0b, 0x4e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x4b, 0x69, 0x74, 0x12, 0x41, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, - 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, - 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x44, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x6e, 0x65, - 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, - 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, - 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, - 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x47, 0x0a, 0x08, 0x49, 0x73, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x1c, 0x2e, - 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x73, 0x42, 0x61, - 0x6e, 0x6e, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, - 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x73, 0x42, 0x61, 0x6e, 0x6e, - 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x6e, - 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, - 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6e, - 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6e, - 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, - 0x0c, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x20, 0x2e, - 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x21, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x42, 0x33, 0x5a, 0x31, 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, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x58, 0x0a, + 0x10, 0x55, 0x6e, 0x62, 0x61, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x65, 0x72, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x22, 0x2b, 0x0a, 0x11, 0x55, 0x6e, 0x62, 0x61, 0x6e, + 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x32, 0xd3, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, + 0x6f, 0x4b, 0x69, 0x74, 0x12, 0x41, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, + 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6e, 0x65, 0x75, + 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, + 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, + 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, + 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, + 0x0e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, + 0x22, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, + 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, + 0x63, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x65, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x08, 0x49, 0x73, 0x42, 0x61, + 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, + 0x70, 0x63, 0x2e, 0x49, 0x73, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, + 0x2e, 0x49, 0x73, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, + 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x08, + 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, + 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, + 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, + 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, + 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x4a, + 0x0a, 0x09, 0x55, 0x6e, 0x62, 0x61, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x6e, 0x65, + 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x6e, 0x62, 0x61, 0x6e, 0x50, + 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x75, + 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x6e, 0x62, 0x61, 0x6e, 0x50, 0x65, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31, 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, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x69, 0x6e, 0x6f, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1216,7 +1335,7 @@ func file_neutrinorpc_neutrino_proto_rawDescGZIP() []byte { return file_neutrinorpc_neutrino_proto_rawDescData } -var file_neutrinorpc_neutrino_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_neutrinorpc_neutrino_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_neutrinorpc_neutrino_proto_goTypes = []interface{}{ (*StatusRequest)(nil), // 0: neutrinorpc.StatusRequest (*StatusResponse)(nil), // 1: neutrinorpc.StatusResponse @@ -1234,6 +1353,8 @@ var file_neutrinorpc_neutrino_proto_goTypes = []interface{}{ (*GetCFilterResponse)(nil), // 13: neutrinorpc.GetCFilterResponse (*GetBlockHashRequest)(nil), // 14: neutrinorpc.GetBlockHashRequest (*GetBlockHashResponse)(nil), // 15: neutrinorpc.GetBlockHashResponse + (*UnbanPeerRequest)(nil), // 16: neutrinorpc.UnbanPeerRequest + (*UnbanPeerResponse)(nil), // 17: neutrinorpc.UnbanPeerResponse } var file_neutrinorpc_neutrino_proto_depIdxs = []int32{ 0, // 0: neutrinorpc.NeutrinoKit.Status:input_type -> neutrinorpc.StatusRequest @@ -1244,16 +1365,18 @@ var file_neutrinorpc_neutrino_proto_depIdxs = []int32{ 10, // 5: neutrinorpc.NeutrinoKit.GetBlock:input_type -> neutrinorpc.GetBlockRequest 12, // 6: neutrinorpc.NeutrinoKit.GetCFilter:input_type -> neutrinorpc.GetCFilterRequest 14, // 7: neutrinorpc.NeutrinoKit.GetBlockHash:input_type -> neutrinorpc.GetBlockHashRequest - 1, // 8: neutrinorpc.NeutrinoKit.Status:output_type -> neutrinorpc.StatusResponse - 3, // 9: neutrinorpc.NeutrinoKit.AddPeer:output_type -> neutrinorpc.AddPeerResponse - 5, // 10: neutrinorpc.NeutrinoKit.DisconnectPeer:output_type -> neutrinorpc.DisconnectPeerResponse - 7, // 11: neutrinorpc.NeutrinoKit.IsBanned:output_type -> neutrinorpc.IsBannedResponse - 9, // 12: neutrinorpc.NeutrinoKit.GetBlockHeader:output_type -> neutrinorpc.GetBlockHeaderResponse - 11, // 13: neutrinorpc.NeutrinoKit.GetBlock:output_type -> neutrinorpc.GetBlockResponse - 13, // 14: neutrinorpc.NeutrinoKit.GetCFilter:output_type -> neutrinorpc.GetCFilterResponse - 15, // 15: neutrinorpc.NeutrinoKit.GetBlockHash:output_type -> neutrinorpc.GetBlockHashResponse - 8, // [8:16] is the sub-list for method output_type - 0, // [0:8] is the sub-list for method input_type + 16, // 8: neutrinorpc.NeutrinoKit.UnbanPeer:input_type -> neutrinorpc.UnbanPeerRequest + 1, // 9: neutrinorpc.NeutrinoKit.Status:output_type -> neutrinorpc.StatusResponse + 3, // 10: neutrinorpc.NeutrinoKit.AddPeer:output_type -> neutrinorpc.AddPeerResponse + 5, // 11: neutrinorpc.NeutrinoKit.DisconnectPeer:output_type -> neutrinorpc.DisconnectPeerResponse + 7, // 12: neutrinorpc.NeutrinoKit.IsBanned:output_type -> neutrinorpc.IsBannedResponse + 9, // 13: neutrinorpc.NeutrinoKit.GetBlockHeader:output_type -> neutrinorpc.GetBlockHeaderResponse + 11, // 14: neutrinorpc.NeutrinoKit.GetBlock:output_type -> neutrinorpc.GetBlockResponse + 13, // 15: neutrinorpc.NeutrinoKit.GetCFilter:output_type -> neutrinorpc.GetCFilterResponse + 15, // 16: neutrinorpc.NeutrinoKit.GetBlockHash:output_type -> neutrinorpc.GetBlockHashResponse + 17, // 17: neutrinorpc.NeutrinoKit.UnbanPeer:output_type -> neutrinorpc.UnbanPeerResponse + 9, // [9:18] is the sub-list for method output_type + 0, // [0:9] 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 @@ -1457,6 +1580,30 @@ func file_neutrinorpc_neutrino_proto_init() { return nil } } + file_neutrinorpc_neutrino_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnbanPeerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_neutrinorpc_neutrino_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnbanPeerResponse); 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{ @@ -1464,7 +1611,7 @@ func file_neutrinorpc_neutrino_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_neutrinorpc_neutrino_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 18, NumExtensions: 0, NumServices: 1, }, diff --git a/lnrpc/neutrinorpc/neutrino.pb.gw.go b/lnrpc/neutrinorpc/neutrino.pb.gw.go index 0d53203987..5dd04b0105 100644 --- a/lnrpc/neutrinorpc/neutrino.pb.gw.go +++ b/lnrpc/neutrinorpc/neutrino.pb.gw.go @@ -361,6 +361,40 @@ func local_request_NeutrinoKit_GetBlockHash_0(ctx context.Context, marshaler run } +func request_NeutrinoKit_UnbanPeer_0(ctx context.Context, marshaler runtime.Marshaler, client NeutrinoKitClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnbanPeerRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UnbanPeer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NeutrinoKit_UnbanPeer_0(ctx context.Context, marshaler runtime.Marshaler, server NeutrinoKitServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnbanPeerRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UnbanPeer(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterNeutrinoKitHandlerServer registers the http handlers for service NeutrinoKit to "mux". // UnaryRPC :call NeutrinoKitServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -551,6 +585,29 @@ func RegisterNeutrinoKitHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_NeutrinoKit_UnbanPeer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/neutrinorpc.NeutrinoKit/UnbanPeer", runtime.WithHTTPPathPattern("/v2/neutrino/unban")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NeutrinoKit_UnbanPeer_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NeutrinoKit_UnbanPeer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -752,6 +809,26 @@ func RegisterNeutrinoKitHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_NeutrinoKit_UnbanPeer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/neutrinorpc.NeutrinoKit/UnbanPeer", runtime.WithHTTPPathPattern("/v2/neutrino/unban")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NeutrinoKit_UnbanPeer_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NeutrinoKit_UnbanPeer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -771,6 +848,8 @@ var ( pattern_NeutrinoKit_GetCFilter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "neutrino", "cfilter", "hash"}, "")) pattern_NeutrinoKit_GetBlockHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "neutrino", "blockhash", "height"}, "")) + + pattern_NeutrinoKit_UnbanPeer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "neutrino", "unban"}, "")) ) var ( @@ -789,4 +868,6 @@ var ( forward_NeutrinoKit_GetCFilter_0 = runtime.ForwardResponseMessage forward_NeutrinoKit_GetBlockHash_0 = runtime.ForwardResponseMessage + + forward_NeutrinoKit_UnbanPeer_0 = runtime.ForwardResponseMessage ) diff --git a/lnrpc/neutrinorpc/neutrino.proto b/lnrpc/neutrinorpc/neutrino.proto index 52d3364828..707dc27150 100644 --- a/lnrpc/neutrinorpc/neutrino.proto +++ b/lnrpc/neutrinorpc/neutrino.proto @@ -71,6 +71,11 @@ service NeutrinoKit { rpc GetBlockHash (GetBlockHashRequest) returns (GetBlockHashResponse) { option deprecated = true; } + + /* + UnbanPeer unbans a previously banned peer and connects to it. + */ + rpc UnbanPeer (UnbanPeerRequest) returns (UnbanPeerResponse); } message StatusRequest { @@ -244,3 +249,17 @@ message GetBlockHashResponse { // The block hash. string hash = 1; } + +message UnbanPeerRequest { + // The address of the peer to be unbanned. + string peer_address = 1; + + // Indicates if the peer to be unbanned should be connected as a + // permanent peer. + bool perm_connect = 2; +} + +message UnbanPeerResponse { + // The status of the UnbanPeer operation. + string status = 1; +} diff --git a/lnrpc/neutrinorpc/neutrino.swagger.json b/lnrpc/neutrinorpc/neutrino.swagger.json index a0f0c01903..cd0bed96e5 100644 --- a/lnrpc/neutrinorpc/neutrino.swagger.json +++ b/lnrpc/neutrinorpc/neutrino.swagger.json @@ -265,6 +265,39 @@ "NeutrinoKit" ] } + }, + "/v2/neutrino/unban": { + "post": { + "summary": "UnbanPeer unbans a previously banned peer and connects to it.", + "operationId": "NeutrinoKit_UnbanPeer", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/neutrinorpcUnbanPeerResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/neutrinorpcUnbanPeerRequest" + } + } + ], + "tags": [ + "NeutrinoKit" + ] + } } }, "definitions": { @@ -505,6 +538,28 @@ } } }, + "neutrinorpcUnbanPeerRequest": { + "type": "object", + "properties": { + "peer_address": { + "type": "string", + "description": "The address of the peer to be unbanned." + }, + "perm_connect": { + "type": "boolean", + "description": "Indicates if the peer to be unbanned should be connected as a\npermanent peer." + } + } + }, + "neutrinorpcUnbanPeerResponse": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "The status of the UnbanPeer operation." + } + } + }, "protobufAny": { "type": "object", "properties": { diff --git a/lnrpc/neutrinorpc/neutrino.yaml b/lnrpc/neutrinorpc/neutrino.yaml index 5cff0b378e..bab265ff88 100644 --- a/lnrpc/neutrinorpc/neutrino.yaml +++ b/lnrpc/neutrinorpc/neutrino.yaml @@ -22,3 +22,6 @@ http: # deprecated - selector: neutrinorpc.NeutrinoKit.GetBlockHash get: "/v2/neutrino/blockhash/{height}" + - selector: neutrinorpc.NeutrinoKit.UnbanPeer + post: "/v2/neutrino/unban" + body: "*" diff --git a/lnrpc/neutrinorpc/neutrino_grpc.pb.go b/lnrpc/neutrinorpc/neutrino_grpc.pb.go index 567d10316f..91de015d59 100644 --- a/lnrpc/neutrinorpc/neutrino_grpc.pb.go +++ b/lnrpc/neutrinorpc/neutrino_grpc.pb.go @@ -47,6 +47,8 @@ type NeutrinoKitClient interface { // Deprecated, use chainrpc.GetBlockHash instead. // GetBlockHash returns the header hash of a block at a given height. GetBlockHash(ctx context.Context, in *GetBlockHashRequest, opts ...grpc.CallOption) (*GetBlockHashResponse, error) + // UnbanPeer unbans a previously banned peer and connects to it. + UnbanPeer(ctx context.Context, in *UnbanPeerRequest, opts ...grpc.CallOption) (*UnbanPeerResponse, error) } type neutrinoKitClient struct { @@ -130,6 +132,15 @@ func (c *neutrinoKitClient) GetBlockHash(ctx context.Context, in *GetBlockHashRe return out, nil } +func (c *neutrinoKitClient) UnbanPeer(ctx context.Context, in *UnbanPeerRequest, opts ...grpc.CallOption) (*UnbanPeerResponse, error) { + out := new(UnbanPeerResponse) + err := c.cc.Invoke(ctx, "/neutrinorpc.NeutrinoKit/UnbanPeer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // NeutrinoKitServer is the server API for NeutrinoKit service. // All implementations must embed UnimplementedNeutrinoKitServer // for forward compatibility @@ -163,6 +174,8 @@ type NeutrinoKitServer interface { // Deprecated, use chainrpc.GetBlockHash instead. // GetBlockHash returns the header hash of a block at a given height. GetBlockHash(context.Context, *GetBlockHashRequest) (*GetBlockHashResponse, error) + // UnbanPeer unbans a previously banned peer and connects to it. + UnbanPeer(context.Context, *UnbanPeerRequest) (*UnbanPeerResponse, error) mustEmbedUnimplementedNeutrinoKitServer() } @@ -194,6 +207,9 @@ func (UnimplementedNeutrinoKitServer) GetCFilter(context.Context, *GetCFilterReq func (UnimplementedNeutrinoKitServer) GetBlockHash(context.Context, *GetBlockHashRequest) (*GetBlockHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlockHash not implemented") } +func (UnimplementedNeutrinoKitServer) UnbanPeer(context.Context, *UnbanPeerRequest) (*UnbanPeerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnbanPeer not implemented") +} func (UnimplementedNeutrinoKitServer) mustEmbedUnimplementedNeutrinoKitServer() {} // UnsafeNeutrinoKitServer may be embedded to opt out of forward compatibility for this service. @@ -351,6 +367,24 @@ func _NeutrinoKit_GetBlockHash_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _NeutrinoKit_UnbanPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnbanPeerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NeutrinoKitServer).UnbanPeer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutrinorpc.NeutrinoKit/UnbanPeer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NeutrinoKitServer).UnbanPeer(ctx, req.(*UnbanPeerRequest)) + } + return interceptor(ctx, in, info, handler) +} + // NeutrinoKit_ServiceDesc is the grpc.ServiceDesc for NeutrinoKit service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -390,6 +424,10 @@ var NeutrinoKit_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetBlockHash", Handler: _NeutrinoKit_GetBlockHash_Handler, }, + { + MethodName: "UnbanPeer", + Handler: _NeutrinoKit_UnbanPeer_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "neutrinorpc/neutrino.proto", diff --git a/lnrpc/neutrinorpc/neutrinokit.pb.json.go b/lnrpc/neutrinorpc/neutrinokit.pb.json.go index 11cc19d306..153f25e069 100644 --- a/lnrpc/neutrinorpc/neutrinokit.pb.json.go +++ b/lnrpc/neutrinorpc/neutrinokit.pb.json.go @@ -220,4 +220,29 @@ func RegisterNeutrinoKitJSONCallbacks(registry map[string]func(ctx context.Conte } callback(string(respBytes), nil) } + + registry["neutrinorpc.NeutrinoKit.UnbanPeer"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &UnbanPeerRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewNeutrinoKitClient(conn) + resp, err := client.UnbanPeer(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } } From 74b51100963db26f15dfe5a6e2e4ad1140882c26 Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen Date: Wed, 19 Apr 2023 16:30:44 +0100 Subject: [PATCH 3/5] lnrpc: Implemented UnbanPeer RPC function Signed-off-by: Ononiwu Maureen --- lnrpc/neutrinorpc/neutrino_server.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lnrpc/neutrinorpc/neutrino_server.go b/lnrpc/neutrinorpc/neutrino_server.go index 65b0c8a6ef..99f428705a 100644 --- a/lnrpc/neutrinorpc/neutrino_server.go +++ b/lnrpc/neutrinorpc/neutrino_server.go @@ -216,6 +216,27 @@ func (s *Server) Status(ctx context.Context, }, nil } +// UnbanPeer unbans a previously banned peer and connects to it. +// +// NOTE: Part of the NeutrinoKitServer interface. +func (s *Server) UnbanPeer(_ context.Context, + in *UnbanPeerRequest) (*UnbanPeerResponse, error) { + + if s.cfg.NeutrinoCS == nil { + return nil, ErrNeutrinoNotActive + } + + err := s.cfg.NeutrinoCS.UnbanPeer(in.PeerAddress, in.PermConnect) + if err != nil { + return nil, err + } + + return &UnbanPeerResponse{ + Status: fmt.Sprintf("successfully unbanned peer, %v", + in.PeerAddress), + }, nil +} + // AddPeer adds a new peer that has already been connected to the server. // // NOTE: Part of the NeutrinoKitServer interface. From 6fc61e299286822485929048491e330d1b84d52e Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen Date: Wed, 19 Apr 2023 16:16:15 +0100 Subject: [PATCH 4/5] cmd: Add "unbanpeer" lncli command. Example usage: lncli neutrino unBanPeer Signed-off-by: Ononiwu Maureen --- cmd/lncli/neutrino_active.go | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/cmd/lncli/neutrino_active.go b/cmd/lncli/neutrino_active.go index 099da46c6e..f19888297a 100644 --- a/cmd/lncli/neutrino_active.go +++ b/cmd/lncli/neutrino_active.go @@ -225,6 +225,50 @@ func getCFilter(ctx *cli.Context) error { return nil } +var unbanPeerCommand = cli.Command{ + Name: "unbanpeer", + Usage: "Unbans a previously banned peer and connects to it.", + Category: "Neutrino", + Description: "Unban and connects to a previously banned peer", + ArgsUsage: "address", + Action: actionDecorator(unbanNeutrinoPeer), + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "permconnect", + Usage: "indicates if the peer to be unbanned should " + + "be connected as a permanent peer.", + }, + }, +} + +func unbanNeutrinoPeer(ctx *cli.Context) error { + ctxc := getContext() + args := ctx.Args() + + // Display the command's help message if we do not have the expected + // number of arguments/flags. + if ctx.NArg() != 1 || ctx.NumFlags() > 1 { + return cli.ShowCommandHelp(ctx, "unbanpeer") + } + + client, cleanUp := getNeutrinoKitClient(ctx) + defer cleanUp() + + req := &neutrinorpc.UnbanPeerRequest{ + PeerAddress: args.First(), + PermConnect: ctx.Bool("permconnect"), + } + + resp, err := client.UnbanPeer(ctxc, req) + if err != nil { + return err + } + + printRespJSON(resp) + + return nil +} + // neutrinoCommands will return the set of commands to enable for neutrinorpc // builds. func neutrinoCommands() []cli.Command { @@ -241,6 +285,7 @@ func neutrinoCommands() []cli.Command { isBannedCommand, getBlockHeaderNeutrinoCommand, getCFilterCommand, + unbanPeerCommand, }, }, } From 71ad55536a0ff4aa3483480f947551d94f3ad7cf Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen <59079323+Chinwendu20@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:09:21 +0100 Subject: [PATCH 5/5] docs: Added release note Signed-off-by: Ononiwu Maureen <59079323+Chinwendu20@users.noreply.github.com> --- docs/release-notes/release-notes-0.18.1.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/release-notes/release-notes-0.18.1.md b/docs/release-notes/release-notes-0.18.1.md index cf5410a2c5..61ebcb9bcf 100644 --- a/docs/release-notes/release-notes-0.18.1.md +++ b/docs/release-notes/release-notes-0.18.1.md @@ -26,12 +26,20 @@ # New Features ## Functional Enhancements ## RPC Additions + +* [Added unbanPeer RPC](https://github.com/lightningnetwork/lnd/pull/7606/). + This would enable unbanning and connecting to a previously banned peer. + ## lncli Additions * [Added](https://github.com/lightningnetwork/lnd/pull/8491) the `cltv_expiry` argument to `addinvoice` and `addholdinvoice`, allowing users to set the `min_final_cltv_expiry_delta` +* [Added unbanPeer command](https://github.com/lightningnetwork/lnd/pull/7606/). + This would enable unbanning and connecting to a previously banned peer using + the lncli command. + # Improvements ## Functional Updates ## RPC Updates