diff --git a/app/component_manager.go b/app/component_manager.go index 39afadc58..02680dc88 100644 --- a/app/component_manager.go +++ b/app/component_manager.go @@ -157,7 +157,7 @@ func setupRPC( func (a *ComponentManager) maybeSeedFromDNS() { if !a.cfg.DisableDNSSeed { - dnsseed.SeedFromDNS(a.cfg.NetParams(), a.cfg.DNSSeed, appmessage.SFNodeNetwork, false, nil, + dnsseed.SeedFromDNS(a.cfg.NetParams(), a.cfg.DNSSeed, false, nil, a.cfg.Lookup, func(addresses []*appmessage.NetAddress) { // Kaspad uses a lookup of the dns seeder here. Since seeder returns // IPs of nodes and not its own IP, we can not know real IP of @@ -165,7 +165,7 @@ func (a *ComponentManager) maybeSeedFromDNS() { a.addressManager.AddAddresses(addresses...) }) - dnsseed.SeedFromGRPC(a.cfg.NetParams(), a.cfg.GRPCSeed, appmessage.SFNodeNetwork, false, nil, + dnsseed.SeedFromGRPC(a.cfg.NetParams(), a.cfg.GRPCSeed, false, nil, func(addresses []*appmessage.NetAddress) { a.addressManager.AddAddresses(addresses...) }) diff --git a/infrastructure/network/dnsseed/pb/peer_service.pb.go b/infrastructure/network/dnsseed/pb/peer_service.pb.go index 3ab470068..3ddaa095f 100644 --- a/infrastructure/network/dnsseed/pb/peer_service.pb.go +++ b/infrastructure/network/dnsseed/pb/peer_service.pb.go @@ -30,9 +30,8 @@ type GetPeersListRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServiceFlag uint64 `protobuf:"varint,1,opt,name=serviceFlag,proto3" json:"serviceFlag,omitempty"` - SubnetworkID []byte `protobuf:"bytes,2,opt,name=subnetworkID,proto3" json:"subnetworkID,omitempty"` - IncludeAllSubnetworks bool `protobuf:"varint,3,opt,name=includeAllSubnetworks,proto3" json:"includeAllSubnetworks,omitempty"` + SubnetworkID []byte `protobuf:"bytes,1,opt,name=subnetworkID,proto3" json:"subnetworkID,omitempty"` + IncludeAllSubnetworks bool `protobuf:"varint,2,opt,name=includeAllSubnetworks,proto3" json:"includeAllSubnetworks,omitempty"` } func (x *GetPeersListRequest) Reset() { @@ -67,13 +66,6 @@ func (*GetPeersListRequest) Descriptor() ([]byte, []int) { return file_peer_service_proto_rawDescGZIP(), []int{0} } -func (x *GetPeersListRequest) GetServiceFlag() uint64 { - if x != nil { - return x.ServiceFlag - } - return 0 -} - func (x *GetPeersListRequest) GetSubnetworkID() []byte { if x != nil { return x.SubnetworkID @@ -141,9 +133,8 @@ type NetAddress struct { unknownFields protoimpl.UnknownFields Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Services uint64 `protobuf:"varint,2,opt,name=services,proto3" json:"services,omitempty"` - IP []byte `protobuf:"bytes,3,opt,name=IP,proto3" json:"IP,omitempty"` - Port uint32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + IP []byte `protobuf:"bytes,2,opt,name=IP,proto3" json:"IP,omitempty"` + Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` } func (x *NetAddress) Reset() { @@ -185,13 +176,6 @@ func (x *NetAddress) GetTimestamp() int64 { return 0 } -func (x *NetAddress) GetServices() uint64 { - if x != nil { - return x.Services - } - return 0 -} - func (x *NetAddress) GetIP() []byte { if x != nil { return x.IP @@ -210,34 +194,30 @@ var File_peer_service_proto protoreflect.FileDescriptor var file_peer_service_proto_rawDesc = []byte{ 0x0a, 0x12, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x22, - 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x49, 0x44, 0x12, 0x34, 0x0a, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x6c, 0x6c, - 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x22, 0x41, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, - 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x29, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4e, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0x6a, 0x0a, 0x0a, 0x4e, - 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x50, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x02, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x32, 0x4c, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x47, - 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x61, 0x73, - 0x70, 0x61, 0x64, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6f, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x73, + 0x75, 0x62, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x44, 0x12, + 0x34, 0x0a, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, + 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x22, 0x41, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, + 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0b, 0x2e, 0x4e, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0x4e, 0x0a, 0x0a, 0x4e, 0x65, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x50, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x02, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x32, 0x4c, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x65, + 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, + 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x61, + 0x73, 0x70, 0x61, 0x64, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/infrastructure/network/dnsseed/pb/peer_service.proto b/infrastructure/network/dnsseed/pb/peer_service.proto index bbcc63a7b..9f5df2e18 100644 --- a/infrastructure/network/dnsseed/pb/peer_service.proto +++ b/infrastructure/network/dnsseed/pb/peer_service.proto @@ -7,9 +7,8 @@ service PeerService { } message GetPeersListRequest { - uint64 serviceFlag = 1; - bytes subnetworkID = 2; - bool includeAllSubnetworks = 3; + bytes subnetworkID = 1; + bool includeAllSubnetworks = 2; } message GetPeersListResponse { @@ -18,7 +17,6 @@ message GetPeersListResponse { message NetAddress { int64 timestamp = 1; - uint64 services = 2; - bytes IP = 3; - uint32 port = 4; + bytes IP = 2; + uint32 port = 3; } \ No newline at end of file diff --git a/infrastructure/network/dnsseed/seed.go b/infrastructure/network/dnsseed/seed.go index ce87210f0..4e6cbc5a7 100644 --- a/infrastructure/network/dnsseed/seed.go +++ b/infrastructure/network/dnsseed/seed.go @@ -31,9 +31,6 @@ const ( // SubnetworkIDPrefixChar is the prefix of subnetworkID, when building a DNS seed request SubnetworkIDPrefixChar byte = 'n' - - // ServiceFlagPrefixChar is the prefix of service flag, when building a DNS seed request - ServiceFlagPrefixChar byte = 'x' ) // OnSeed is the signature of the callback function which is invoked when DNS @@ -44,7 +41,7 @@ type OnSeed func(addrs []*appmessage.NetAddress) type LookupFunc func(string) ([]net.IP, error) // SeedFromDNS uses DNS seeding to populate the address manager with peers. -func SeedFromDNS(dagParams *dagconfig.Params, customSeed string, reqServices appmessage.ServiceFlag, includeAllSubnetworks bool, +func SeedFromDNS(dagParams *dagconfig.Params, customSeed string, includeAllSubnetworks bool, subnetworkID *externalapi.DomainSubnetworkID, lookupFn LookupFunc, seedFn OnSeed) { var dnsSeeds []string @@ -55,12 +52,7 @@ func SeedFromDNS(dagParams *dagconfig.Params, customSeed string, reqServices app } for _, dnsseed := range dnsSeeds { - var host string - if reqServices == appmessage.SFNodeNetwork { - host = dnsseed - } else { - host = fmt.Sprintf("%c%x.%s", ServiceFlagPrefixChar, uint64(reqServices), dnsseed) - } + host := dnsseed if !includeAllSubnetworks { if subnetworkID != nil { @@ -103,8 +95,9 @@ func SeedFromDNS(dagParams *dagconfig.Params, customSeed string, reqServices app } // SeedFromGRPC send gRPC request to get list of peers for a given host -func SeedFromGRPC(dagParams *dagconfig.Params, customSeed string, reqServices appmessage.ServiceFlag, includeAllSubnetworks bool, +func SeedFromGRPC(dagParams *dagconfig.Params, customSeed string, includeAllSubnetworks bool, subnetworkID *externalapi.DomainSubnetworkID, seedFn OnSeed) { + var grpcSeeds []string if customSeed != "" { grpcSeeds = []string{customSeed} @@ -130,7 +123,6 @@ func SeedFromGRPC(dagParams *dagconfig.Params, customSeed string, reqServices ap } req := &pb2.GetPeersListRequest{ - ServiceFlag: uint64(reqServices), SubnetworkID: subnetID, IncludeAllSubnetworks: includeAllSubnetworks, }