From 94ee038cd9c75a272334309a53a6840d12338e5a Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sat, 18 Jun 2022 12:45:46 +0200 Subject: [PATCH 01/13] checkpoint --- app/appmessage/rpc_get_info.go | 26 +- app/component_manager.go | 5 +- app/rpc/manager.go | 3 + app/rpc/rpccontext/context.go | 4 + app/rpc/rpchandlers/get_info.go | 6 + .../server/grpcserver/protowire/rpc.md | 6 + .../server/grpcserver/protowire/rpc.pb.go | 223 +++++++++++------- .../server/grpcserver/protowire/rpc.proto | 6 + .../grpcserver/protowire/rpc_get_info.go | 31 ++- 9 files changed, 219 insertions(+), 91 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index 00c9882e7d..2403e2610b 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -20,11 +20,17 @@ func NewGetInfoRequestMessage() *GetInfoRequestMessage { // its respective RPC message type GetInfoResponseMessage struct { baseMessage - P2PID string - MempoolSize uint64 - ServerVersion string - IsUtxoIndexed bool - IsSynced bool + P2PID string + MempoolSize uint64 + ServerVersion string + IsUtxoIndexed bool + IsSynced bool + MaxRPCClients int64 + NumberOfRPCConnections int64 + MaxP2PClients int64 + NumberOfP2PConnections int64 + BanDuration int64 + UptimeInSeconds int64 Error *RPCError } @@ -35,12 +41,20 @@ func (msg *GetInfoResponseMessage) Command() MessageCommand { } // NewGetInfoResponseMessage returns a instance of the message -func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, isUtxoIndexed bool, isSynced bool) *GetInfoResponseMessage { +func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, + isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, + maxP2PClients, int64, numberOfP2PConnections int64, banDuration int64, + uptimeInSeconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ P2PID: p2pID, MempoolSize: mempoolSize, ServerVersion: serverVersion, IsUtxoIndexed: isUtxoIndexed, IsSynced: isSynced, + MaxRPCClients: maxRPCClients, + NumberOfRPCConnections: numberOfRPCConnections, + MaxP2PClients: numberOfP2PConnections, + NumberOfP2PConnections: numberOfP2PConnections, + UptimeInSeconds: uptimeInSeconds, } } diff --git a/app/component_manager.go b/app/component_manager.go index 33b9a2c097..bfac64758f 100644 --- a/app/component_manager.go +++ b/app/component_manager.go @@ -3,6 +3,7 @@ package app import ( "fmt" "sync/atomic" + "time" "github.com/kaspanet/kaspad/domain/consensus/model/externalapi" @@ -30,7 +31,8 @@ type ComponentManager struct { rpcManager *rpc.Manager connectionManager *connmanager.ConnectionManager netAdapter *netadapter.NetAdapter - + + startTime time.Time started, shutdown int32 } @@ -49,6 +51,7 @@ func (a *ComponentManager) Start() { } a.connectionManager.Start() + a.startTime = time.Now() } // Stop gracefully shuts down all the kaspad services. diff --git a/app/rpc/manager.go b/app/rpc/manager.go index 137fd65555..f71d61fd78 100644 --- a/app/rpc/manager.go +++ b/app/rpc/manager.go @@ -1,6 +1,7 @@ package rpc import ( + "github.com/kaspanet/kaspad/app" "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/app/protocol" "github.com/kaspanet/kaspad/app/rpc/rpccontext" @@ -29,6 +30,7 @@ func NewManager( connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, utxoIndex *utxoindex.UTXOIndex, + componentManager *app.ComponentManager, consensusEventsChan chan externalapi.ConsensusEvent, shutDownChan chan<- struct{}) *Manager { @@ -41,6 +43,7 @@ func NewManager( connectionManager, addressManager, utxoIndex, + componentManager, shutDownChan, ), } diff --git a/app/rpc/rpccontext/context.go b/app/rpc/rpccontext/context.go index e4674ef620..618fb0b3e1 100644 --- a/app/rpc/rpccontext/context.go +++ b/app/rpc/rpccontext/context.go @@ -1,6 +1,7 @@ package rpccontext import ( + "github.com/kaspanet/kaspad/app" "github.com/kaspanet/kaspad/app/protocol" "github.com/kaspanet/kaspad/domain" "github.com/kaspanet/kaspad/domain/utxoindex" @@ -19,6 +20,7 @@ type Context struct { ConnectionManager *connmanager.ConnectionManager AddressManager *addressmanager.AddressManager UTXOIndex *utxoindex.UTXOIndex + ComponentManager *app.ComponentManager ShutDownChan chan<- struct{} NotificationManager *NotificationManager @@ -32,6 +34,7 @@ func NewContext(cfg *config.Config, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, utxoIndex *utxoindex.UTXOIndex, + componentManager *app.ComponentManager, shutDownChan chan<- struct{}) *Context { context := &Context{ @@ -43,6 +46,7 @@ func NewContext(cfg *config.Config, AddressManager: addressManager, UTXOIndex: utxoIndex, ShutDownChan: shutDownChan, + ComponentManager: componentManager, } context.NotificationManager = NewNotificationManager(cfg.ActiveNetParams) diff --git a/app/rpc/rpchandlers/get_info.go b/app/rpc/rpchandlers/get_info.go index 2b72d74284..614c8cfc16 100644 --- a/app/rpc/rpchandlers/get_info.go +++ b/app/rpc/rpchandlers/get_info.go @@ -20,6 +20,12 @@ func HandleGetInfo(context *rpccontext.Context, _ *router.Router, _ appmessage.M version.Version(), context.Config.UTXOIndex, context.ProtocolManager.Context().HasPeers() && isNearlySynced, + int64(context.Config.RPCMaxClients), + int64(context.ConnectionManager.ConnectionCount()), + int64(context.Config.MaxInboundPeers), + int64(context.NetAdapter.P2PConnectionCount()), + int64(context.Config.BanDuration.Seconds()), + ) return response, nil diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md index 12a22923c6..68707531bd 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md @@ -1701,6 +1701,12 @@ GetInfoRequestMessage returns info about the node. | serverVersion | [string](#string) | | | | isUtxoIndexed | [bool](#bool) | | | | isSynced | [bool](#bool) | | | +| maxRPCClients | [int64](#int64) | | | +| numberOfRPCConnections | [int64](#int64) | | | +| maxP2PClients | [int64](#int64) | | | +| numberOfP2PConnections | [int64](#int64) | | | +| banDuration | [int64](#int64) | | | +| uptimeInSeconds | [int64](#int64) | | | | error | [RPCError](#protowire.RPCError) | | | diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go index a72e70fe47..3613b11db5 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go @@ -5506,12 +5506,18 @@ type GetInfoResponseMessage struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - P2PId string `protobuf:"bytes,1,opt,name=p2pId,proto3" json:"p2pId,omitempty"` - MempoolSize uint64 `protobuf:"varint,2,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` - ServerVersion string `protobuf:"bytes,3,opt,name=serverVersion,proto3" json:"serverVersion,omitempty"` - IsUtxoIndexed bool `protobuf:"varint,4,opt,name=isUtxoIndexed,proto3" json:"isUtxoIndexed,omitempty"` - IsSynced bool `protobuf:"varint,5,opt,name=isSynced,proto3" json:"isSynced,omitempty"` - Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` + P2PId string `protobuf:"bytes,1,opt,name=p2pId,proto3" json:"p2pId,omitempty"` + MempoolSize uint64 `protobuf:"varint,2,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` + ServerVersion string `protobuf:"bytes,3,opt,name=serverVersion,proto3" json:"serverVersion,omitempty"` + IsUtxoIndexed bool `protobuf:"varint,4,opt,name=isUtxoIndexed,proto3" json:"isUtxoIndexed,omitempty"` + IsSynced bool `protobuf:"varint,5,opt,name=isSynced,proto3" json:"isSynced,omitempty"` + MaxRPCClients int64 `protobuf:"varint,6,opt,name=maxRPCClients,proto3" json:"maxRPCClients,omitempty"` + NumberOfRPCConnections int64 `protobuf:"varint,7,opt,name=numberOfRPCConnections,proto3" json:"numberOfRPCConnections,omitempty"` + MaxP2PClients int64 `protobuf:"varint,8,opt,name=maxP2PClients,proto3" json:"maxP2PClients,omitempty"` + NumberOfP2PConnections int64 `protobuf:"varint,9,opt,name=numberOfP2PConnections,proto3" json:"numberOfP2PConnections,omitempty"` + BanDuration int64 `protobuf:"varint,10,opt,name=banDuration,proto3" json:"banDuration,omitempty"` + UptimeInSeconds int64 `protobuf:"varint,11,opt,name=uptimeInSeconds,proto3" json:"uptimeInSeconds,omitempty"` + Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` } func (x *GetInfoResponseMessage) Reset() { @@ -5581,6 +5587,48 @@ func (x *GetInfoResponseMessage) GetIsSynced() bool { return false } +func (x *GetInfoResponseMessage) GetMaxRPCClients() int64 { + if x != nil { + return x.MaxRPCClients + } + return 0 +} + +func (x *GetInfoResponseMessage) GetNumberOfRPCConnections() int64 { + if x != nil { + return x.NumberOfRPCConnections + } + return 0 +} + +func (x *GetInfoResponseMessage) GetMaxP2PClients() int64 { + if x != nil { + return x.MaxP2PClients + } + return 0 +} + +func (x *GetInfoResponseMessage) GetNumberOfP2PConnections() int64 { + if x != nil { + return x.NumberOfP2PConnections + } + return 0 +} + +func (x *GetInfoResponseMessage) GetBanDuration() int64 { + if x != nil { + return x.BanDuration + } + return 0 +} + +func (x *GetInfoResponseMessage) GetUptimeInSeconds() int64 { + if x != nil { + return x.UptimeInSeconds + } + return 0 +} + func (x *GetInfoResponseMessage) GetError() *RPCError { if x != nil { return x.Error @@ -6832,7 +6880,7 @@ var file_rpc_proto_rawDesc = []byte{ 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0xe4, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0xec, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, @@ -6843,81 +6891,98 @@ var file_rpc_proto_rawDesc = []byte{ 0x78, 0x6f, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x55, 0x74, 0x78, 0x6f, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x69, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, - 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, - 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, - 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, - 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, - 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, - 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x52, 0x08, 0x69, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, + 0x78, 0x52, 0x50, 0x43, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x52, 0x50, 0x43, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x52, 0x50, 0x43, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x50, + 0x32, 0x50, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0d, 0x6d, 0x61, 0x78, 0x50, 0x32, 0x50, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x36, + 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x61, 0x6e, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x75, 0x70, 0x74, 0x69, + 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0f, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, + 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6c, + 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, - 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, 0x01, 0x0a, + 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, + 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, + 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, + 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, - 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, - 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, - 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, - 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, - 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, - 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, - 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, - 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, - 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, - 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, + 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, + 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, - 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, - 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, - 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, - 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x65, + 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, + 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, + 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, + 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, + 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, + 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, + 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, + 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, + 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, + 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x1d, 0x0a, + 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, 0x01, 0x0a, + 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x69, 0x72, + 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, + 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, + 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto index 81919c9540..29f41ac0e4 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto @@ -663,6 +663,12 @@ message GetInfoResponseMessage{ string serverVersion = 3; bool isUtxoIndexed = 4; bool isSynced = 5; + int64 maxRPCClients = 6; + int64 numberOfRPCConnections = 7; + int64 maxP2PClients = 8; + int64 numberOfP2PConnections = 9; + int64 banDuration = 10; + int64 uptimeInSeconds = 11; RPCError error = 1000; } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index a75f07dd73..857573599c 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -27,11 +27,22 @@ func (x *KaspadMessage_GetInfoResponse) fromAppMessage(message *appmessage.GetIn err = &RPCError{Message: message.Error.Message} } x.GetInfoResponse = &GetInfoResponseMessage{ - P2PId: message.P2PID, - ServerVersion: message.ServerVersion, - MempoolSize: message.MempoolSize, - IsUtxoIndexed: message.IsUtxoIndexed, - IsSynced: message.IsSynced, + P2PId: message.P2PID, + ServerVersion: message.ServerVersion, + MempoolSize: message.MempoolSize, + + IsUtxoIndexed: message.IsUtxoIndexed, + IsSynced: message.IsSynced, + + MaxRPCClients: message.MaxRPCClients, + NumberOfRPCConnections: message.NumberOfRPCConnections, + MaxP2PClients: message.MaxRPCClients, + NumberOfP2PConnections: message.NumberOfP2PConnections, + + BanDuration: message.BanDuration, + + UptimeInSeconds: message.UptimeInSeconds, + Error: err, } return nil @@ -55,8 +66,18 @@ func (x *GetInfoResponseMessage) toAppMessage() (appmessage.Message, error) { P2PID: x.P2PId, MempoolSize: x.MempoolSize, ServerVersion: x.ServerVersion, + IsUtxoIndexed: x.IsUtxoIndexed, IsSynced: x.IsSynced, + + MaxRPCClients: x.MaxRPCClients, + NumberOfRPCConnections: x.NumberOfRPCConnections, + + MaxP2PClients: x.MaxP2PClients, + NumberOfP2PConnections: x.NumberOfP2PConnections, + + BanDuration: x.BanDuration, + UptimeInSeconds: x.UptimeInSeconds, Error: rpcErr, }, nil From a4afb4fb30798601a80b8e7e4d188b4b564a1236 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sat, 18 Jun 2022 13:14:02 +0200 Subject: [PATCH 02/13] . --- app/component_manager.go | 2 -- app/rpc/manager.go | 3 --- app/rpc/rpccontext/context.go | 4 ---- infrastructure/network/netadapter/netadapter.go | 2 ++ 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/component_manager.go b/app/component_manager.go index bfac64758f..428b351989 100644 --- a/app/component_manager.go +++ b/app/component_manager.go @@ -32,7 +32,6 @@ type ComponentManager struct { connectionManager *connmanager.ConnectionManager netAdapter *netadapter.NetAdapter - startTime time.Time started, shutdown int32 } @@ -51,7 +50,6 @@ func (a *ComponentManager) Start() { } a.connectionManager.Start() - a.startTime = time.Now() } // Stop gracefully shuts down all the kaspad services. diff --git a/app/rpc/manager.go b/app/rpc/manager.go index f71d61fd78..137fd65555 100644 --- a/app/rpc/manager.go +++ b/app/rpc/manager.go @@ -1,7 +1,6 @@ package rpc import ( - "github.com/kaspanet/kaspad/app" "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/app/protocol" "github.com/kaspanet/kaspad/app/rpc/rpccontext" @@ -30,7 +29,6 @@ func NewManager( connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, utxoIndex *utxoindex.UTXOIndex, - componentManager *app.ComponentManager, consensusEventsChan chan externalapi.ConsensusEvent, shutDownChan chan<- struct{}) *Manager { @@ -43,7 +41,6 @@ func NewManager( connectionManager, addressManager, utxoIndex, - componentManager, shutDownChan, ), } diff --git a/app/rpc/rpccontext/context.go b/app/rpc/rpccontext/context.go index 618fb0b3e1..e4674ef620 100644 --- a/app/rpc/rpccontext/context.go +++ b/app/rpc/rpccontext/context.go @@ -1,7 +1,6 @@ package rpccontext import ( - "github.com/kaspanet/kaspad/app" "github.com/kaspanet/kaspad/app/protocol" "github.com/kaspanet/kaspad/domain" "github.com/kaspanet/kaspad/domain/utxoindex" @@ -20,7 +19,6 @@ type Context struct { ConnectionManager *connmanager.ConnectionManager AddressManager *addressmanager.AddressManager UTXOIndex *utxoindex.UTXOIndex - ComponentManager *app.ComponentManager ShutDownChan chan<- struct{} NotificationManager *NotificationManager @@ -34,7 +32,6 @@ func NewContext(cfg *config.Config, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, utxoIndex *utxoindex.UTXOIndex, - componentManager *app.ComponentManager, shutDownChan chan<- struct{}) *Context { context := &Context{ @@ -46,7 +43,6 @@ func NewContext(cfg *config.Config, AddressManager: addressManager, UTXOIndex: utxoIndex, ShutDownChan: shutDownChan, - ComponentManager: componentManager, } context.NotificationManager = NewNotificationManager(cfg.ActiveNetParams) diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index 0f50c8deb2..46543d96c4 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -31,6 +31,8 @@ type NetAdapter struct { rpcRouterInitializer RouterInitializer stop uint32 + startTime time.Time + p2pConnections map[*NetConnection]struct{} p2pConnectionsLock sync.RWMutex } From b9542ed86df8404c5e44dad55eaa7e997b5e8635 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 10:57:59 +0200 Subject: [PATCH 03/13] add rpc connectin count --- app/appmessage/rpc_get_info.go | 42 +++++++++---------- app/component_manager.go | 3 +- app/rpc/manager.go | 1 + app/rpc/rpccontext/context.go | 3 ++ app/rpc/rpchandlers/get_info.go | 6 ++- .../network/netadapter/netadapter.go | 13 +++++- .../grpcserver/protowire/rpc_get_info.go | 40 +++++++++--------- 7 files changed, 62 insertions(+), 46 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index 2403e2610b..f2a753bc90 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -20,17 +20,17 @@ func NewGetInfoRequestMessage() *GetInfoRequestMessage { // its respective RPC message type GetInfoResponseMessage struct { baseMessage - P2PID string - MempoolSize uint64 - ServerVersion string - IsUtxoIndexed bool - IsSynced bool - MaxRPCClients int64 - NumberOfRPCConnections int64 - MaxP2PClients int64 - NumberOfP2PConnections int64 - BanDuration int64 - UptimeInSeconds int64 + P2PID string + MempoolSize uint64 + ServerVersion string + IsUtxoIndexed bool + IsSynced bool + MaxRPCClients int64 + NumberOfRPCConnections int64 + MaxP2PClients int64 + NumberOfP2PConnections int64 + BanDuration int64 + UptimeInSeconds int64 Error *RPCError } @@ -42,19 +42,19 @@ func (msg *GetInfoResponseMessage) Command() MessageCommand { // NewGetInfoResponseMessage returns a instance of the message func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, - isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, - maxP2PClients, int64, numberOfP2PConnections int64, banDuration int64, + isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, + maxP2PClients int64, numberOfP2PConnections int64, banDuration int64, uptimeInSeconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ - P2PID: p2pID, - MempoolSize: mempoolSize, - ServerVersion: serverVersion, - IsUtxoIndexed: isUtxoIndexed, - IsSynced: isSynced, - MaxRPCClients: maxRPCClients, + P2PID: p2pID, + MempoolSize: mempoolSize, + ServerVersion: serverVersion, + IsUtxoIndexed: isUtxoIndexed, + IsSynced: isSynced, + MaxRPCClients: maxRPCClients, NumberOfRPCConnections: numberOfRPCConnections, - MaxP2PClients: numberOfP2PConnections, + MaxP2PClients: numberOfP2PConnections, NumberOfP2PConnections: numberOfP2PConnections, - UptimeInSeconds: uptimeInSeconds, + UptimeInSeconds: uptimeInSeconds, } } diff --git a/app/component_manager.go b/app/component_manager.go index 428b351989..33b9a2c097 100644 --- a/app/component_manager.go +++ b/app/component_manager.go @@ -3,7 +3,6 @@ package app import ( "fmt" "sync/atomic" - "time" "github.com/kaspanet/kaspad/domain/consensus/model/externalapi" @@ -31,7 +30,7 @@ type ComponentManager struct { rpcManager *rpc.Manager connectionManager *connmanager.ConnectionManager netAdapter *netadapter.NetAdapter - + started, shutdown int32 } diff --git a/app/rpc/manager.go b/app/rpc/manager.go index 137fd65555..361265dace 100644 --- a/app/rpc/manager.go +++ b/app/rpc/manager.go @@ -28,6 +28,7 @@ func NewManager( protocolManager *protocol.Manager, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, + rpcManager *RpcManager, utxoIndex *utxoindex.UTXOIndex, consensusEventsChan chan externalapi.ConsensusEvent, shutDownChan chan<- struct{}) *Manager { diff --git a/app/rpc/rpccontext/context.go b/app/rpc/rpccontext/context.go index e4674ef620..fd80672092 100644 --- a/app/rpc/rpccontext/context.go +++ b/app/rpc/rpccontext/context.go @@ -18,6 +18,7 @@ type Context struct { ProtocolManager *protocol.Manager ConnectionManager *connmanager.ConnectionManager AddressManager *addressmanager.AddressManager + rpcManager *rpc.Manager UTXOIndex *utxoindex.UTXOIndex ShutDownChan chan<- struct{} @@ -31,6 +32,7 @@ func NewContext(cfg *config.Config, protocolManager *protocol.Manager, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, + rpcManager *rpc.Manager, utxoIndex *utxoindex.UTXOIndex, shutDownChan chan<- struct{}) *Context { @@ -41,6 +43,7 @@ func NewContext(cfg *config.Config, ProtocolManager: protocolManager, ConnectionManager: connectionManager, AddressManager: addressManager, + RPCManager: rpcManager, UTXOIndex: utxoIndex, ShutDownChan: shutDownChan, } diff --git a/app/rpc/rpchandlers/get_info.go b/app/rpc/rpchandlers/get_info.go index 614c8cfc16..932c787fb2 100644 --- a/app/rpc/rpchandlers/get_info.go +++ b/app/rpc/rpchandlers/get_info.go @@ -1,6 +1,8 @@ package rpchandlers import ( + "time" + "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/app/rpc/rpccontext" "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router" @@ -21,11 +23,11 @@ func HandleGetInfo(context *rpccontext.Context, _ *router.Router, _ appmessage.M context.Config.UTXOIndex, context.ProtocolManager.Context().HasPeers() && isNearlySynced, int64(context.Config.RPCMaxClients), - int64(context.ConnectionManager.ConnectionCount()), + int64(context.NetAdapter.RPCConnectionCount()), int64(context.Config.MaxInboundPeers), int64(context.NetAdapter.P2PConnectionCount()), int64(context.Config.BanDuration.Seconds()), - + int64(time.Since(context.NetAdapter.StartTime).Seconds()), ) return response, nil diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index 46543d96c4..e5958e7fbc 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -3,6 +3,7 @@ package netadapter import ( "sync" "sync/atomic" + "time" "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/infrastructure/config" @@ -31,9 +32,11 @@ type NetAdapter struct { rpcRouterInitializer RouterInitializer stop uint32 - startTime time.Time + StartTime time.Time p2pConnections map[*NetConnection]struct{} + rpcConnections map[*NetConnection]struct{} + p2pConnectionsLock sync.RWMutex } @@ -80,11 +83,14 @@ func (na *NetAdapter) Start() error { if err != nil { return err } + err = na.rpcServer.Start() if err != nil { return err } + na.StartTime = time.Now() + return nil } @@ -149,9 +155,14 @@ func (na *NetAdapter) onP2PConnectedHandler(connection server.Connection) error return nil } +func (na *NetAdapter) RPCConnectionCount() int { + return len(na.rpcConnections) +} + func (na *NetAdapter) onRPCConnectedHandler(connection server.Connection) error { netConnection := newNetConnection(connection, na.rpcRouterInitializer, "on RPC connected") netConnection.setOnDisconnectedHandler(func() {}) + na.rpcConnections[netConnection] = struct{}{} netConnection.start() return nil diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index 857573599c..bef2e2234a 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -27,23 +27,23 @@ func (x *KaspadMessage_GetInfoResponse) fromAppMessage(message *appmessage.GetIn err = &RPCError{Message: message.Error.Message} } x.GetInfoResponse = &GetInfoResponseMessage{ - P2PId: message.P2PID, - ServerVersion: message.ServerVersion, - MempoolSize: message.MempoolSize, - - IsUtxoIndexed: message.IsUtxoIndexed, - IsSynced: message.IsSynced, - - MaxRPCClients: message.MaxRPCClients, + P2PId: message.P2PID, + ServerVersion: message.ServerVersion, + MempoolSize: message.MempoolSize, + + IsUtxoIndexed: message.IsUtxoIndexed, + IsSynced: message.IsSynced, + + MaxRPCClients: message.MaxRPCClients, NumberOfRPCConnections: message.NumberOfRPCConnections, - MaxP2PClients: message.MaxRPCClients, + MaxP2PClients: message.MaxRPCClients, NumberOfP2PConnections: message.NumberOfP2PConnections, - BanDuration: message.BanDuration, + BanDuration: message.BanDuration, - UptimeInSeconds: message.UptimeInSeconds, - - Error: err, + UptimeInSeconds: message.UptimeInSeconds, + + Error: err, } return nil } @@ -66,17 +66,17 @@ func (x *GetInfoResponseMessage) toAppMessage() (appmessage.Message, error) { P2PID: x.P2PId, MempoolSize: x.MempoolSize, ServerVersion: x.ServerVersion, - + IsUtxoIndexed: x.IsUtxoIndexed, IsSynced: x.IsSynced, - - MaxRPCClients: x.MaxRPCClients, + + MaxRPCClients: x.MaxRPCClients, NumberOfRPCConnections: x.NumberOfRPCConnections, - - MaxP2PClients: x.MaxP2PClients, + + MaxP2PClients: x.MaxP2PClients, NumberOfP2PConnections: x.NumberOfP2PConnections, - - BanDuration: x.BanDuration, + + BanDuration: x.BanDuration, UptimeInSeconds: x.UptimeInSeconds, Error: rpcErr, From 8296b57c5dbc9c0f64a3f6d7b5c22a8dc57ebec7 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 10:59:37 +0200 Subject: [PATCH 04/13] maxp2p --- app/appmessage/rpc_get_info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index f2a753bc90..1c88bbc160 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -53,7 +53,7 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s IsSynced: isSynced, MaxRPCClients: maxRPCClients, NumberOfRPCConnections: numberOfRPCConnections, - MaxP2PClients: numberOfP2PConnections, + MaxP2PClients: maxP2PClients, NumberOfP2PConnections: numberOfP2PConnections, UptimeInSeconds: uptimeInSeconds, } From 2a06c981a4691c47aeded1773a53f8adf6c56e77 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 11:00:30 +0200 Subject: [PATCH 05/13] fix --- app/rpc/manager.go | 1 - app/rpc/rpccontext/context.go | 3 --- 2 files changed, 4 deletions(-) diff --git a/app/rpc/manager.go b/app/rpc/manager.go index 361265dace..137fd65555 100644 --- a/app/rpc/manager.go +++ b/app/rpc/manager.go @@ -28,7 +28,6 @@ func NewManager( protocolManager *protocol.Manager, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, - rpcManager *RpcManager, utxoIndex *utxoindex.UTXOIndex, consensusEventsChan chan externalapi.ConsensusEvent, shutDownChan chan<- struct{}) *Manager { diff --git a/app/rpc/rpccontext/context.go b/app/rpc/rpccontext/context.go index fd80672092..e4674ef620 100644 --- a/app/rpc/rpccontext/context.go +++ b/app/rpc/rpccontext/context.go @@ -18,7 +18,6 @@ type Context struct { ProtocolManager *protocol.Manager ConnectionManager *connmanager.ConnectionManager AddressManager *addressmanager.AddressManager - rpcManager *rpc.Manager UTXOIndex *utxoindex.UTXOIndex ShutDownChan chan<- struct{} @@ -32,7 +31,6 @@ func NewContext(cfg *config.Config, protocolManager *protocol.Manager, connectionManager *connmanager.ConnectionManager, addressManager *addressmanager.AddressManager, - rpcManager *rpc.Manager, utxoIndex *utxoindex.UTXOIndex, shutDownChan chan<- struct{}) *Context { @@ -43,7 +41,6 @@ func NewContext(cfg *config.Config, ProtocolManager: protocolManager, ConnectionManager: connectionManager, AddressManager: addressManager, - RPCManager: rpcManager, UTXOIndex: utxoIndex, ShutDownChan: shutDownChan, } From d6315432088b9e380a951778db9dbac68aae1f97 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 11:06:07 +0200 Subject: [PATCH 06/13] comment --- app/appmessage/rpc_get_info.go | 6 +++--- infrastructure/network/netadapter/netadapter.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index 1c88bbc160..67e483d0d1 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -41,9 +41,9 @@ func (msg *GetInfoResponseMessage) Command() MessageCommand { } // NewGetInfoResponseMessage returns a instance of the message -func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, - isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, - maxP2PClients int64, numberOfP2PConnections int64, banDuration int64, +func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, + isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, + maxP2PClients int64, numberOfP2PConnections int64, banDuration int64, uptimeInSeconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ P2PID: p2pID, diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index e5958e7fbc..8b24ee1717 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -34,8 +34,8 @@ type NetAdapter struct { StartTime time.Time - p2pConnections map[*NetConnection]struct{} - rpcConnections map[*NetConnection]struct{} + p2pConnections map[*NetConnection]struct{} + rpcConnections map[*NetConnection]struct{} p2pConnectionsLock sync.RWMutex } @@ -155,6 +155,7 @@ func (na *NetAdapter) onP2PConnectedHandler(connection server.Connection) error return nil } +// RPCConnectionCount returns the count of the connected rpc connections func (na *NetAdapter) RPCConnectionCount() int { return len(na.rpcConnections) } From 7ca07ce0b695321da0ad75e2000ea06e1e8b2b1a Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 11:17:28 +0200 Subject: [PATCH 07/13] fixes --- app/appmessage/rpc_get_info.go | 1 + infrastructure/network/netadapter/netadapter.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index 67e483d0d1..e49d559087 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -55,6 +55,7 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s NumberOfRPCConnections: numberOfRPCConnections, MaxP2PClients: maxP2PClients, NumberOfP2PConnections: numberOfP2PConnections, + BanDuration: banDuration, UptimeInSeconds: uptimeInSeconds, } } diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index 8b24ee1717..f3c6be3b73 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -62,6 +62,7 @@ func NewNetAdapter(cfg *config.Config) (*NetAdapter, error) { rpcServer: rpcServer, p2pConnections: make(map[*NetConnection]struct{}), + rpcConnections: make(map[*NetConnection]struct{}), } adapter.p2pServer.SetOnConnectedHandler(adapter.onP2PConnectedHandler) @@ -162,8 +163,11 @@ func (na *NetAdapter) RPCConnectionCount() int { func (na *NetAdapter) onRPCConnectedHandler(connection server.Connection) error { netConnection := newNetConnection(connection, na.rpcRouterInitializer, "on RPC connected") - netConnection.setOnDisconnectedHandler(func() {}) + netConnection.setOnDisconnectedHandler(func() { + delete(na.rpcConnections, netConnection) + }) na.rpcConnections[netConnection] = struct{}{} + netConnection.start() return nil From 2b598f5cadfeb872bb39fe6d815ac763cba7a102 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 11:20:39 +0200 Subject: [PATCH 08/13] fmt --- app/appmessage/rpc_get_info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index e49d559087..fedb466d41 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -55,7 +55,7 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s NumberOfRPCConnections: numberOfRPCConnections, MaxP2PClients: maxP2PClients, NumberOfP2PConnections: numberOfP2PConnections, - BanDuration: banDuration, + BanDuration: banDuration, UptimeInSeconds: uptimeInSeconds, } } From fc168a1ae51ef24d7130d2904669892715385eb3 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 12:04:48 +0200 Subject: [PATCH 09/13] BanDuration to BanDurationInSeconds --- app/appmessage/rpc_get_info.go | 6 +- .../server/grpcserver/protowire/rpc.md | 2 +- .../server/grpcserver/protowire/rpc.pb.go | 165 +++++++++--------- .../server/grpcserver/protowire/rpc.proto | 2 +- .../grpcserver/protowire/rpc_get_info.go | 6 +- 5 files changed, 91 insertions(+), 90 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index fedb466d41..3a48314f14 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -29,7 +29,7 @@ type GetInfoResponseMessage struct { NumberOfRPCConnections int64 MaxP2PClients int64 NumberOfP2PConnections int64 - BanDuration int64 + BanDurationInSeconds int64 UptimeInSeconds int64 Error *RPCError @@ -43,7 +43,7 @@ func (msg *GetInfoResponseMessage) Command() MessageCommand { // NewGetInfoResponseMessage returns a instance of the message func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, - maxP2PClients int64, numberOfP2PConnections int64, banDuration int64, + maxP2PClients int64, numberOfP2PConnections int64, banDurationInSeconds int64, uptimeInSeconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ P2PID: p2pID, @@ -55,7 +55,7 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s NumberOfRPCConnections: numberOfRPCConnections, MaxP2PClients: maxP2PClients, NumberOfP2PConnections: numberOfP2PConnections, - BanDuration: banDuration, + BanDurationInSeconds: banDurationInSeconds, UptimeInSeconds: uptimeInSeconds, } } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md index 68707531bd..748a8cc8e9 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md @@ -1705,7 +1705,7 @@ GetInfoRequestMessage returns info about the node. | numberOfRPCConnections | [int64](#int64) | | | | maxP2PClients | [int64](#int64) | | | | numberOfP2PConnections | [int64](#int64) | | | -| banDuration | [int64](#int64) | | | +| banDurationInSeconds | [int64](#int64) | | | | uptimeInSeconds | [int64](#int64) | | | | error | [RPCError](#protowire.RPCError) | | | diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go index 3613b11db5..d72c6c21aa 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go @@ -5515,7 +5515,7 @@ type GetInfoResponseMessage struct { NumberOfRPCConnections int64 `protobuf:"varint,7,opt,name=numberOfRPCConnections,proto3" json:"numberOfRPCConnections,omitempty"` MaxP2PClients int64 `protobuf:"varint,8,opt,name=maxP2PClients,proto3" json:"maxP2PClients,omitempty"` NumberOfP2PConnections int64 `protobuf:"varint,9,opt,name=numberOfP2PConnections,proto3" json:"numberOfP2PConnections,omitempty"` - BanDuration int64 `protobuf:"varint,10,opt,name=banDuration,proto3" json:"banDuration,omitempty"` + BanDurationInSeconds int64 `protobuf:"varint,10,opt,name=banDurationInSeconds,proto3" json:"banDurationInSeconds,omitempty"` UptimeInSeconds int64 `protobuf:"varint,11,opt,name=uptimeInSeconds,proto3" json:"uptimeInSeconds,omitempty"` Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` } @@ -5615,9 +5615,9 @@ func (x *GetInfoResponseMessage) GetNumberOfP2PConnections() int64 { return 0 } -func (x *GetInfoResponseMessage) GetBanDuration() int64 { +func (x *GetInfoResponseMessage) GetBanDurationInSeconds() int64 { if x != nil { - return x.BanDuration + return x.BanDurationInSeconds } return 0 } @@ -6880,7 +6880,7 @@ var file_rpc_proto_rawDesc = []byte{ 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0xec, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0xfe, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, @@ -6903,86 +6903,87 @@ var file_rpc_proto_rawDesc = []byte{ 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x61, 0x6e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x75, 0x70, 0x74, 0x69, - 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0f, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, - 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, - 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6c, - 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, - 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, 0x01, 0x0a, - 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, - 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, - 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, - 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, - 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, - 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, 0x70, 0x6f, - 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x65, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, - 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, - 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, - 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, - 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, - 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, - 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, - 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, - 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, - 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, - 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, - 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x1d, 0x0a, - 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, 0x01, 0x0a, - 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x69, 0x72, - 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, - 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x75, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0f, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, + 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, + 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, + 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, + 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, + 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, + 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, + 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, + 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, + 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, + 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, + 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, + 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, + 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, + 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, + 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, + 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, + 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, + 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, + 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, + 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, + 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto index 29f41ac0e4..ce27e4ae73 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto @@ -667,7 +667,7 @@ message GetInfoResponseMessage{ int64 numberOfRPCConnections = 7; int64 maxP2PClients = 8; int64 numberOfP2PConnections = 9; - int64 banDuration = 10; + int64 banDurationInSeconds = 10; int64 uptimeInSeconds = 11; RPCError error = 1000; } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index bef2e2234a..e8f03ed6ac 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -39,7 +39,7 @@ func (x *KaspadMessage_GetInfoResponse) fromAppMessage(message *appmessage.GetIn MaxP2PClients: message.MaxRPCClients, NumberOfP2PConnections: message.NumberOfP2PConnections, - BanDuration: message.BanDuration, + BanDurationInSeconds: message.BanDurationInSeconds, UptimeInSeconds: message.UptimeInSeconds, @@ -76,8 +76,8 @@ func (x *GetInfoResponseMessage) toAppMessage() (appmessage.Message, error) { MaxP2PClients: x.MaxP2PClients, NumberOfP2PConnections: x.NumberOfP2PConnections, - BanDuration: x.BanDuration, - UptimeInSeconds: x.UptimeInSeconds, + BanDurationInSeconds: x.BanDurationInSeconds, + UptimeInSeconds: x.UptimeInSeconds, Error: rpcErr, }, nil From a0d8c5dee2a07899a60fe4e074f3e387abd2cd49 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 12:47:02 +0200 Subject: [PATCH 10/13] bug in converter --- .../netadapter/server/grpcserver/protowire/rpc_get_info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index e8f03ed6ac..d8fa7d61df 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -36,7 +36,7 @@ func (x *KaspadMessage_GetInfoResponse) fromAppMessage(message *appmessage.GetIn MaxRPCClients: message.MaxRPCClients, NumberOfRPCConnections: message.NumberOfRPCConnections, - MaxP2PClients: message.MaxRPCClients, + MaxP2PClients: message.MaxP2PClients, NumberOfP2PConnections: message.NumberOfP2PConnections, BanDurationInSeconds: message.BanDurationInSeconds, From e63644da22094d2cffefb7279719e90d670ba679 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 13:06:02 +0200 Subject: [PATCH 11/13] from seconds to milliseconds. --- app/appmessage/rpc_get_info.go | 12 +- app/rpc/rpchandlers/get_info.go | 4 +- .../network/netadapter/netadapter.go | 20 +- .../server/grpcserver/protowire/rpc.md | 4 +- .../server/grpcserver/protowire/rpc.pb.go | 189 +++++++++--------- .../server/grpcserver/protowire/rpc.proto | 4 +- .../grpcserver/protowire/rpc_get_info.go | 8 +- 7 files changed, 129 insertions(+), 112 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index 3a48314f14..af67ff528b 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -29,8 +29,8 @@ type GetInfoResponseMessage struct { NumberOfRPCConnections int64 MaxP2PClients int64 NumberOfP2PConnections int64 - BanDurationInSeconds int64 - UptimeInSeconds int64 + BanDurationInMilliseconds int64 + UptimeInMilliseconds int64 Error *RPCError } @@ -43,8 +43,8 @@ func (msg *GetInfoResponseMessage) Command() MessageCommand { // NewGetInfoResponseMessage returns a instance of the message func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, isUtxoIndexed bool, isSynced bool, maxRPCClients int64, numberOfRPCConnections int64, - maxP2PClients int64, numberOfP2PConnections int64, banDurationInSeconds int64, - uptimeInSeconds int64) *GetInfoResponseMessage { + maxP2PClients int64, numberOfP2PConnections int64, banDurationInMilliseconds int64, + uptimeInMilliseconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ P2PID: p2pID, MempoolSize: mempoolSize, @@ -55,7 +55,7 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s NumberOfRPCConnections: numberOfRPCConnections, MaxP2PClients: maxP2PClients, NumberOfP2PConnections: numberOfP2PConnections, - BanDurationInSeconds: banDurationInSeconds, - UptimeInSeconds: uptimeInSeconds, + BanDurationInMilliseconds: banDurationInMilliseconds, + UptimeInMilliseconds: uptimeInMilliseconds, } } diff --git a/app/rpc/rpchandlers/get_info.go b/app/rpc/rpchandlers/get_info.go index 932c787fb2..8becca85da 100644 --- a/app/rpc/rpchandlers/get_info.go +++ b/app/rpc/rpchandlers/get_info.go @@ -26,8 +26,8 @@ func HandleGetInfo(context *rpccontext.Context, _ *router.Router, _ appmessage.M int64(context.NetAdapter.RPCConnectionCount()), int64(context.Config.MaxInboundPeers), int64(context.NetAdapter.P2PConnectionCount()), - int64(context.Config.BanDuration.Seconds()), - int64(time.Since(context.NetAdapter.StartTime).Seconds()), + int64(context.Config.BanDuration.Milliseconds()), + int64(context.NetAdapter.UptimeInMilliseconds()), ) return response, nil diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index f3c6be3b73..c99c1b7514 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -32,12 +32,13 @@ type NetAdapter struct { rpcRouterInitializer RouterInitializer stop uint32 - StartTime time.Time + startTime time.Time p2pConnections map[*NetConnection]struct{} rpcConnections map[*NetConnection]struct{} p2pConnectionsLock sync.RWMutex + rpcConnectionsLock sync.RWMutex } // NewNetAdapter creates and starts a new NetAdapter on the @@ -90,7 +91,7 @@ func (na *NetAdapter) Start() error { return err } - na.StartTime = time.Now() + na.startTime = time.Now() return nil } @@ -158,12 +159,23 @@ func (na *NetAdapter) onP2PConnectedHandler(connection server.Connection) error // RPCConnectionCount returns the count of the connected rpc connections func (na *NetAdapter) RPCConnectionCount() int { + na.rpcConnectionsLock.RLock() + defer na.rpcConnectionsLock.RUnlock() + return len(na.rpcConnections) } func (na *NetAdapter) onRPCConnectedHandler(connection server.Connection) error { + + na.rpcConnectionsLock.Lock() + defer na.rpcConnectionsLock.Unlock() + netConnection := newNetConnection(connection, na.rpcRouterInitializer, "on RPC connected") netConnection.setOnDisconnectedHandler(func() { + + na.rpcConnectionsLock.Lock() + defer na.rpcConnectionsLock.Unlock() + delete(na.rpcConnections, netConnection) }) na.rpcConnections[netConnection] = struct{}{} @@ -208,3 +220,7 @@ func (na *NetAdapter) P2PBroadcast(netConnections []*NetConnection, message appm } return nil } + +func (na *NetAdapter) UptimeInMilliseconds() int64 { + return time.Since(na.startTime).Milliseconds() +} diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md index 748a8cc8e9..bfe4ce8cd1 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md @@ -1705,8 +1705,8 @@ GetInfoRequestMessage returns info about the node. | numberOfRPCConnections | [int64](#int64) | | | | maxP2PClients | [int64](#int64) | | | | numberOfP2PConnections | [int64](#int64) | | | -| banDurationInSeconds | [int64](#int64) | | | -| uptimeInSeconds | [int64](#int64) | | | +| banDurationInMilliseconds | [int64](#int64) | | | +| uptimeInMilliseconds | [int64](#int64) | | | | error | [RPCError](#protowire.RPCError) | | | diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go index d72c6c21aa..d5012df613 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go @@ -5506,18 +5506,18 @@ type GetInfoResponseMessage struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - P2PId string `protobuf:"bytes,1,opt,name=p2pId,proto3" json:"p2pId,omitempty"` - MempoolSize uint64 `protobuf:"varint,2,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` - ServerVersion string `protobuf:"bytes,3,opt,name=serverVersion,proto3" json:"serverVersion,omitempty"` - IsUtxoIndexed bool `protobuf:"varint,4,opt,name=isUtxoIndexed,proto3" json:"isUtxoIndexed,omitempty"` - IsSynced bool `protobuf:"varint,5,opt,name=isSynced,proto3" json:"isSynced,omitempty"` - MaxRPCClients int64 `protobuf:"varint,6,opt,name=maxRPCClients,proto3" json:"maxRPCClients,omitempty"` - NumberOfRPCConnections int64 `protobuf:"varint,7,opt,name=numberOfRPCConnections,proto3" json:"numberOfRPCConnections,omitempty"` - MaxP2PClients int64 `protobuf:"varint,8,opt,name=maxP2PClients,proto3" json:"maxP2PClients,omitempty"` - NumberOfP2PConnections int64 `protobuf:"varint,9,opt,name=numberOfP2PConnections,proto3" json:"numberOfP2PConnections,omitempty"` - BanDurationInSeconds int64 `protobuf:"varint,10,opt,name=banDurationInSeconds,proto3" json:"banDurationInSeconds,omitempty"` - UptimeInSeconds int64 `protobuf:"varint,11,opt,name=uptimeInSeconds,proto3" json:"uptimeInSeconds,omitempty"` - Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` + P2PId string `protobuf:"bytes,1,opt,name=p2pId,proto3" json:"p2pId,omitempty"` + MempoolSize uint64 `protobuf:"varint,2,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` + ServerVersion string `protobuf:"bytes,3,opt,name=serverVersion,proto3" json:"serverVersion,omitempty"` + IsUtxoIndexed bool `protobuf:"varint,4,opt,name=isUtxoIndexed,proto3" json:"isUtxoIndexed,omitempty"` + IsSynced bool `protobuf:"varint,5,opt,name=isSynced,proto3" json:"isSynced,omitempty"` + MaxRPCClients int64 `protobuf:"varint,6,opt,name=maxRPCClients,proto3" json:"maxRPCClients,omitempty"` + NumberOfRPCConnections int64 `protobuf:"varint,7,opt,name=numberOfRPCConnections,proto3" json:"numberOfRPCConnections,omitempty"` + MaxP2PClients int64 `protobuf:"varint,8,opt,name=maxP2PClients,proto3" json:"maxP2PClients,omitempty"` + NumberOfP2PConnections int64 `protobuf:"varint,9,opt,name=numberOfP2PConnections,proto3" json:"numberOfP2PConnections,omitempty"` + BanDurationInMilliseconds int64 `protobuf:"varint,10,opt,name=banDurationInMilliseconds,proto3" json:"banDurationInMilliseconds,omitempty"` + UptimeInMilliseconds int64 `protobuf:"varint,11,opt,name=uptimeInMilliseconds,proto3" json:"uptimeInMilliseconds,omitempty"` + Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` } func (x *GetInfoResponseMessage) Reset() { @@ -5615,16 +5615,16 @@ func (x *GetInfoResponseMessage) GetNumberOfP2PConnections() int64 { return 0 } -func (x *GetInfoResponseMessage) GetBanDurationInSeconds() int64 { +func (x *GetInfoResponseMessage) GetBanDurationInMilliseconds() int64 { if x != nil { - return x.BanDurationInSeconds + return x.BanDurationInMilliseconds } return 0 } -func (x *GetInfoResponseMessage) GetUptimeInSeconds() int64 { +func (x *GetInfoResponseMessage) GetUptimeInMilliseconds() int64 { if x != nil { - return x.UptimeInSeconds + return x.UptimeInMilliseconds } return 0 } @@ -6880,7 +6880,7 @@ var file_rpc_proto_rawDesc = []byte{ 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0xfe, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x92, 0x04, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x32, 0x70, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, @@ -6903,87 +6903,88 @@ var file_rpc_proto_rawDesc = []byte{ 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x50, 0x32, 0x50, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x75, 0x70, - 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0f, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x53, 0x65, 0x63, - 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, - 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, - 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, - 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, - 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, - 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x19, 0x62, 0x61, 0x6e, 0x44, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x19, 0x62, 0x61, 0x6e, 0x44, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, + 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x14, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x4d, 0x69, 0x6c, 0x6c, + 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, - 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, - 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, - 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, - 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, - 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, - 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, - 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, - 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, - 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, - 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, - 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, - 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, - 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, - 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, - 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, - 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, - 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, - 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, + 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, + 0x73, 0x68, 0x22, 0x93, 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, + 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, + 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x22, 0x53, 0x0a, 0x25, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, + 0x15, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x31, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, + 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, + 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, + 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, + 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, + 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, + 0x2a, 0x0a, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, + 0x6d, 0x70, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, + 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 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, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto index ce27e4ae73..20d36c6909 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto @@ -667,8 +667,8 @@ message GetInfoResponseMessage{ int64 numberOfRPCConnections = 7; int64 maxP2PClients = 8; int64 numberOfP2PConnections = 9; - int64 banDurationInSeconds = 10; - int64 uptimeInSeconds = 11; + int64 banDurationInMilliseconds = 10; + int64 uptimeInMilliseconds = 11; RPCError error = 1000; } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index d8fa7d61df..8b0e465d7c 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -39,9 +39,9 @@ func (x *KaspadMessage_GetInfoResponse) fromAppMessage(message *appmessage.GetIn MaxP2PClients: message.MaxP2PClients, NumberOfP2PConnections: message.NumberOfP2PConnections, - BanDurationInSeconds: message.BanDurationInSeconds, + BanDurationInMilliseconds: message.BanDurationInMilliseconds, - UptimeInSeconds: message.UptimeInSeconds, + UptimeInMilliseconds: message.UptimeInMilliseconds, Error: err, } @@ -76,8 +76,8 @@ func (x *GetInfoResponseMessage) toAppMessage() (appmessage.Message, error) { MaxP2PClients: x.MaxP2PClients, NumberOfP2PConnections: x.NumberOfP2PConnections, - BanDurationInSeconds: x.BanDurationInSeconds, - UptimeInSeconds: x.UptimeInSeconds, + BanDurationInMilliseconds: x.BanDurationInMilliseconds, + UptimeInMilliseconds: x.UptimeInMilliseconds, Error: rpcErr, }, nil From fb6e959522a05cde9b966c15732517ffc1771aa9 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 13:07:39 +0200 Subject: [PATCH 12/13] fmt / linting --- app/appmessage/rpc_get_info.go | 44 +++++++++---------- .../network/netadapter/netadapter.go | 1 + .../grpcserver/protowire/rpc_get_info.go | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/appmessage/rpc_get_info.go b/app/appmessage/rpc_get_info.go index af67ff528b..b7aa780d05 100644 --- a/app/appmessage/rpc_get_info.go +++ b/app/appmessage/rpc_get_info.go @@ -20,17 +20,17 @@ func NewGetInfoRequestMessage() *GetInfoRequestMessage { // its respective RPC message type GetInfoResponseMessage struct { baseMessage - P2PID string - MempoolSize uint64 - ServerVersion string - IsUtxoIndexed bool - IsSynced bool - MaxRPCClients int64 - NumberOfRPCConnections int64 - MaxP2PClients int64 - NumberOfP2PConnections int64 - BanDurationInMilliseconds int64 - UptimeInMilliseconds int64 + P2PID string + MempoolSize uint64 + ServerVersion string + IsUtxoIndexed bool + IsSynced bool + MaxRPCClients int64 + NumberOfRPCConnections int64 + MaxP2PClients int64 + NumberOfP2PConnections int64 + BanDurationInMilliseconds int64 + UptimeInMilliseconds int64 Error *RPCError } @@ -46,16 +46,16 @@ func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion s maxP2PClients int64, numberOfP2PConnections int64, banDurationInMilliseconds int64, uptimeInMilliseconds int64) *GetInfoResponseMessage { return &GetInfoResponseMessage{ - P2PID: p2pID, - MempoolSize: mempoolSize, - ServerVersion: serverVersion, - IsUtxoIndexed: isUtxoIndexed, - IsSynced: isSynced, - MaxRPCClients: maxRPCClients, - NumberOfRPCConnections: numberOfRPCConnections, - MaxP2PClients: maxP2PClients, - NumberOfP2PConnections: numberOfP2PConnections, - BanDurationInMilliseconds: banDurationInMilliseconds, - UptimeInMilliseconds: uptimeInMilliseconds, + P2PID: p2pID, + MempoolSize: mempoolSize, + ServerVersion: serverVersion, + IsUtxoIndexed: isUtxoIndexed, + IsSynced: isSynced, + MaxRPCClients: maxRPCClients, + NumberOfRPCConnections: numberOfRPCConnections, + MaxP2PClients: maxP2PClients, + NumberOfP2PConnections: numberOfP2PConnections, + BanDurationInMilliseconds: banDurationInMilliseconds, + UptimeInMilliseconds: uptimeInMilliseconds, } } diff --git a/infrastructure/network/netadapter/netadapter.go b/infrastructure/network/netadapter/netadapter.go index c99c1b7514..207bfcee12 100644 --- a/infrastructure/network/netadapter/netadapter.go +++ b/infrastructure/network/netadapter/netadapter.go @@ -221,6 +221,7 @@ func (na *NetAdapter) P2PBroadcast(netConnections []*NetConnection, message appm return nil } +// UptimeInMilliseconds returns this netAdapter's uptime in milliseconds func (na *NetAdapter) UptimeInMilliseconds() int64 { return time.Since(na.startTime).Milliseconds() } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go index 8b0e465d7c..1a2b5958d5 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_info.go @@ -77,7 +77,7 @@ func (x *GetInfoResponseMessage) toAppMessage() (appmessage.Message, error) { NumberOfP2PConnections: x.NumberOfP2PConnections, BanDurationInMilliseconds: x.BanDurationInMilliseconds, - UptimeInMilliseconds: x.UptimeInMilliseconds, + UptimeInMilliseconds: x.UptimeInMilliseconds, Error: rpcErr, }, nil From 2292ec69e90c6c04f2223d541f5e690aa4096438 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Sun, 19 Jun 2022 13:08:34 +0200 Subject: [PATCH 13/13] remove time import --- app/rpc/rpchandlers/get_info.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/rpc/rpchandlers/get_info.go b/app/rpc/rpchandlers/get_info.go index 8becca85da..45562f8a85 100644 --- a/app/rpc/rpchandlers/get_info.go +++ b/app/rpc/rpchandlers/get_info.go @@ -1,8 +1,6 @@ package rpchandlers import ( - "time" - "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/app/rpc/rpccontext" "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"