github.com/ledgerwatch/erigon-lib@v1.0.0/gointerfaces/txpool/mining_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.3.0 4 // - protoc v4.24.2 5 // source: txpool/mining.proto 6 7 package txpool 8 9 import ( 10 context "context" 11 types "github.com/ledgerwatch/erigon-lib/gointerfaces/types" 12 grpc "google.golang.org/grpc" 13 codes "google.golang.org/grpc/codes" 14 status "google.golang.org/grpc/status" 15 emptypb "google.golang.org/protobuf/types/known/emptypb" 16 ) 17 18 // This is a compile-time assertion to ensure that this generated file 19 // is compatible with the grpc package it is being compiled against. 20 // Requires gRPC-Go v1.32.0 or later. 21 const _ = grpc.SupportPackageIsVersion7 22 23 const ( 24 Mining_Version_FullMethodName = "/txpool.Mining/Version" 25 Mining_OnPendingBlock_FullMethodName = "/txpool.Mining/OnPendingBlock" 26 Mining_OnMinedBlock_FullMethodName = "/txpool.Mining/OnMinedBlock" 27 Mining_OnPendingLogs_FullMethodName = "/txpool.Mining/OnPendingLogs" 28 Mining_GetWork_FullMethodName = "/txpool.Mining/GetWork" 29 Mining_SubmitWork_FullMethodName = "/txpool.Mining/SubmitWork" 30 Mining_SubmitHashRate_FullMethodName = "/txpool.Mining/SubmitHashRate" 31 Mining_HashRate_FullMethodName = "/txpool.Mining/HashRate" 32 Mining_Mining_FullMethodName = "/txpool.Mining/Mining" 33 ) 34 35 // MiningClient is the client API for Mining service. 36 // 37 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 38 type MiningClient interface { 39 // Version returns the service version number 40 Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.VersionReply, error) 41 // subscribe to pending blocks event 42 OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (Mining_OnPendingBlockClient, error) 43 // subscribe to mined blocks event 44 OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (Mining_OnMinedBlockClient, error) 45 // subscribe to pending blocks event 46 OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (Mining_OnPendingLogsClient, error) 47 // GetWork returns a work package for external miner. 48 // 49 // The work package consists of 3 strings: 50 // 51 // result[0] - 32 bytes hex encoded current block header pow-hash 52 // result[1] - 32 bytes hex encoded seed hash used for DAG 53 // result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty 54 // result[3] - hex encoded block number 55 GetWork(ctx context.Context, in *GetWorkRequest, opts ...grpc.CallOption) (*GetWorkReply, error) 56 // SubmitWork can be used by external miner to submit their POW solution. 57 // It returns an indication if the work was accepted. 58 // Note either an invalid solution, a stale work a non-existent work will return false. 59 SubmitWork(ctx context.Context, in *SubmitWorkRequest, opts ...grpc.CallOption) (*SubmitWorkReply, error) 60 // SubmitHashRate can be used for remote miners to submit their hash rate. 61 // This enables the node to report the combined hash rate of all miners 62 // which submit work through this node. 63 // 64 // It accepts the miner hash rate and an identifier which must be unique 65 // between nodes. 66 SubmitHashRate(ctx context.Context, in *SubmitHashRateRequest, opts ...grpc.CallOption) (*SubmitHashRateReply, error) 67 // HashRate returns the current hashrate for local CPU miner and remote miner. 68 HashRate(ctx context.Context, in *HashRateRequest, opts ...grpc.CallOption) (*HashRateReply, error) 69 // Mining returns an indication if this node is currently mining and it's mining configuration 70 Mining(ctx context.Context, in *MiningRequest, opts ...grpc.CallOption) (*MiningReply, error) 71 } 72 73 type miningClient struct { 74 cc grpc.ClientConnInterface 75 } 76 77 func NewMiningClient(cc grpc.ClientConnInterface) MiningClient { 78 return &miningClient{cc} 79 } 80 81 func (c *miningClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.VersionReply, error) { 82 out := new(types.VersionReply) 83 err := c.cc.Invoke(ctx, Mining_Version_FullMethodName, in, out, opts...) 84 if err != nil { 85 return nil, err 86 } 87 return out, nil 88 } 89 90 func (c *miningClient) OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (Mining_OnPendingBlockClient, error) { 91 stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[0], Mining_OnPendingBlock_FullMethodName, opts...) 92 if err != nil { 93 return nil, err 94 } 95 x := &miningOnPendingBlockClient{stream} 96 if err := x.ClientStream.SendMsg(in); err != nil { 97 return nil, err 98 } 99 if err := x.ClientStream.CloseSend(); err != nil { 100 return nil, err 101 } 102 return x, nil 103 } 104 105 type Mining_OnPendingBlockClient interface { 106 Recv() (*OnPendingBlockReply, error) 107 grpc.ClientStream 108 } 109 110 type miningOnPendingBlockClient struct { 111 grpc.ClientStream 112 } 113 114 func (x *miningOnPendingBlockClient) Recv() (*OnPendingBlockReply, error) { 115 m := new(OnPendingBlockReply) 116 if err := x.ClientStream.RecvMsg(m); err != nil { 117 return nil, err 118 } 119 return m, nil 120 } 121 122 func (c *miningClient) OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (Mining_OnMinedBlockClient, error) { 123 stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[1], Mining_OnMinedBlock_FullMethodName, opts...) 124 if err != nil { 125 return nil, err 126 } 127 x := &miningOnMinedBlockClient{stream} 128 if err := x.ClientStream.SendMsg(in); err != nil { 129 return nil, err 130 } 131 if err := x.ClientStream.CloseSend(); err != nil { 132 return nil, err 133 } 134 return x, nil 135 } 136 137 type Mining_OnMinedBlockClient interface { 138 Recv() (*OnMinedBlockReply, error) 139 grpc.ClientStream 140 } 141 142 type miningOnMinedBlockClient struct { 143 grpc.ClientStream 144 } 145 146 func (x *miningOnMinedBlockClient) Recv() (*OnMinedBlockReply, error) { 147 m := new(OnMinedBlockReply) 148 if err := x.ClientStream.RecvMsg(m); err != nil { 149 return nil, err 150 } 151 return m, nil 152 } 153 154 func (c *miningClient) OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (Mining_OnPendingLogsClient, error) { 155 stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[2], Mining_OnPendingLogs_FullMethodName, opts...) 156 if err != nil { 157 return nil, err 158 } 159 x := &miningOnPendingLogsClient{stream} 160 if err := x.ClientStream.SendMsg(in); err != nil { 161 return nil, err 162 } 163 if err := x.ClientStream.CloseSend(); err != nil { 164 return nil, err 165 } 166 return x, nil 167 } 168 169 type Mining_OnPendingLogsClient interface { 170 Recv() (*OnPendingLogsReply, error) 171 grpc.ClientStream 172 } 173 174 type miningOnPendingLogsClient struct { 175 grpc.ClientStream 176 } 177 178 func (x *miningOnPendingLogsClient) Recv() (*OnPendingLogsReply, error) { 179 m := new(OnPendingLogsReply) 180 if err := x.ClientStream.RecvMsg(m); err != nil { 181 return nil, err 182 } 183 return m, nil 184 } 185 186 func (c *miningClient) GetWork(ctx context.Context, in *GetWorkRequest, opts ...grpc.CallOption) (*GetWorkReply, error) { 187 out := new(GetWorkReply) 188 err := c.cc.Invoke(ctx, Mining_GetWork_FullMethodName, in, out, opts...) 189 if err != nil { 190 return nil, err 191 } 192 return out, nil 193 } 194 195 func (c *miningClient) SubmitWork(ctx context.Context, in *SubmitWorkRequest, opts ...grpc.CallOption) (*SubmitWorkReply, error) { 196 out := new(SubmitWorkReply) 197 err := c.cc.Invoke(ctx, Mining_SubmitWork_FullMethodName, in, out, opts...) 198 if err != nil { 199 return nil, err 200 } 201 return out, nil 202 } 203 204 func (c *miningClient) SubmitHashRate(ctx context.Context, in *SubmitHashRateRequest, opts ...grpc.CallOption) (*SubmitHashRateReply, error) { 205 out := new(SubmitHashRateReply) 206 err := c.cc.Invoke(ctx, Mining_SubmitHashRate_FullMethodName, in, out, opts...) 207 if err != nil { 208 return nil, err 209 } 210 return out, nil 211 } 212 213 func (c *miningClient) HashRate(ctx context.Context, in *HashRateRequest, opts ...grpc.CallOption) (*HashRateReply, error) { 214 out := new(HashRateReply) 215 err := c.cc.Invoke(ctx, Mining_HashRate_FullMethodName, in, out, opts...) 216 if err != nil { 217 return nil, err 218 } 219 return out, nil 220 } 221 222 func (c *miningClient) Mining(ctx context.Context, in *MiningRequest, opts ...grpc.CallOption) (*MiningReply, error) { 223 out := new(MiningReply) 224 err := c.cc.Invoke(ctx, Mining_Mining_FullMethodName, in, out, opts...) 225 if err != nil { 226 return nil, err 227 } 228 return out, nil 229 } 230 231 // MiningServer is the server API for Mining service. 232 // All implementations must embed UnimplementedMiningServer 233 // for forward compatibility 234 type MiningServer interface { 235 // Version returns the service version number 236 Version(context.Context, *emptypb.Empty) (*types.VersionReply, error) 237 // subscribe to pending blocks event 238 OnPendingBlock(*OnPendingBlockRequest, Mining_OnPendingBlockServer) error 239 // subscribe to mined blocks event 240 OnMinedBlock(*OnMinedBlockRequest, Mining_OnMinedBlockServer) error 241 // subscribe to pending blocks event 242 OnPendingLogs(*OnPendingLogsRequest, Mining_OnPendingLogsServer) error 243 // GetWork returns a work package for external miner. 244 // 245 // The work package consists of 3 strings: 246 // 247 // result[0] - 32 bytes hex encoded current block header pow-hash 248 // result[1] - 32 bytes hex encoded seed hash used for DAG 249 // result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty 250 // result[3] - hex encoded block number 251 GetWork(context.Context, *GetWorkRequest) (*GetWorkReply, error) 252 // SubmitWork can be used by external miner to submit their POW solution. 253 // It returns an indication if the work was accepted. 254 // Note either an invalid solution, a stale work a non-existent work will return false. 255 SubmitWork(context.Context, *SubmitWorkRequest) (*SubmitWorkReply, error) 256 // SubmitHashRate can be used for remote miners to submit their hash rate. 257 // This enables the node to report the combined hash rate of all miners 258 // which submit work through this node. 259 // 260 // It accepts the miner hash rate and an identifier which must be unique 261 // between nodes. 262 SubmitHashRate(context.Context, *SubmitHashRateRequest) (*SubmitHashRateReply, error) 263 // HashRate returns the current hashrate for local CPU miner and remote miner. 264 HashRate(context.Context, *HashRateRequest) (*HashRateReply, error) 265 // Mining returns an indication if this node is currently mining and it's mining configuration 266 Mining(context.Context, *MiningRequest) (*MiningReply, error) 267 mustEmbedUnimplementedMiningServer() 268 } 269 270 // UnimplementedMiningServer must be embedded to have forward compatible implementations. 271 type UnimplementedMiningServer struct { 272 } 273 274 func (UnimplementedMiningServer) Version(context.Context, *emptypb.Empty) (*types.VersionReply, error) { 275 return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") 276 } 277 func (UnimplementedMiningServer) OnPendingBlock(*OnPendingBlockRequest, Mining_OnPendingBlockServer) error { 278 return status.Errorf(codes.Unimplemented, "method OnPendingBlock not implemented") 279 } 280 func (UnimplementedMiningServer) OnMinedBlock(*OnMinedBlockRequest, Mining_OnMinedBlockServer) error { 281 return status.Errorf(codes.Unimplemented, "method OnMinedBlock not implemented") 282 } 283 func (UnimplementedMiningServer) OnPendingLogs(*OnPendingLogsRequest, Mining_OnPendingLogsServer) error { 284 return status.Errorf(codes.Unimplemented, "method OnPendingLogs not implemented") 285 } 286 func (UnimplementedMiningServer) GetWork(context.Context, *GetWorkRequest) (*GetWorkReply, error) { 287 return nil, status.Errorf(codes.Unimplemented, "method GetWork not implemented") 288 } 289 func (UnimplementedMiningServer) SubmitWork(context.Context, *SubmitWorkRequest) (*SubmitWorkReply, error) { 290 return nil, status.Errorf(codes.Unimplemented, "method SubmitWork not implemented") 291 } 292 func (UnimplementedMiningServer) SubmitHashRate(context.Context, *SubmitHashRateRequest) (*SubmitHashRateReply, error) { 293 return nil, status.Errorf(codes.Unimplemented, "method SubmitHashRate not implemented") 294 } 295 func (UnimplementedMiningServer) HashRate(context.Context, *HashRateRequest) (*HashRateReply, error) { 296 return nil, status.Errorf(codes.Unimplemented, "method HashRate not implemented") 297 } 298 func (UnimplementedMiningServer) Mining(context.Context, *MiningRequest) (*MiningReply, error) { 299 return nil, status.Errorf(codes.Unimplemented, "method Mining not implemented") 300 } 301 func (UnimplementedMiningServer) mustEmbedUnimplementedMiningServer() {} 302 303 // UnsafeMiningServer may be embedded to opt out of forward compatibility for this service. 304 // Use of this interface is not recommended, as added methods to MiningServer will 305 // result in compilation errors. 306 type UnsafeMiningServer interface { 307 mustEmbedUnimplementedMiningServer() 308 } 309 310 func RegisterMiningServer(s grpc.ServiceRegistrar, srv MiningServer) { 311 s.RegisterService(&Mining_ServiceDesc, srv) 312 } 313 314 func _Mining_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 315 in := new(emptypb.Empty) 316 if err := dec(in); err != nil { 317 return nil, err 318 } 319 if interceptor == nil { 320 return srv.(MiningServer).Version(ctx, in) 321 } 322 info := &grpc.UnaryServerInfo{ 323 Server: srv, 324 FullMethod: Mining_Version_FullMethodName, 325 } 326 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 327 return srv.(MiningServer).Version(ctx, req.(*emptypb.Empty)) 328 } 329 return interceptor(ctx, in, info, handler) 330 } 331 332 func _Mining_OnPendingBlock_Handler(srv interface{}, stream grpc.ServerStream) error { 333 m := new(OnPendingBlockRequest) 334 if err := stream.RecvMsg(m); err != nil { 335 return err 336 } 337 return srv.(MiningServer).OnPendingBlock(m, &miningOnPendingBlockServer{stream}) 338 } 339 340 type Mining_OnPendingBlockServer interface { 341 Send(*OnPendingBlockReply) error 342 grpc.ServerStream 343 } 344 345 type miningOnPendingBlockServer struct { 346 grpc.ServerStream 347 } 348 349 func (x *miningOnPendingBlockServer) Send(m *OnPendingBlockReply) error { 350 return x.ServerStream.SendMsg(m) 351 } 352 353 func _Mining_OnMinedBlock_Handler(srv interface{}, stream grpc.ServerStream) error { 354 m := new(OnMinedBlockRequest) 355 if err := stream.RecvMsg(m); err != nil { 356 return err 357 } 358 return srv.(MiningServer).OnMinedBlock(m, &miningOnMinedBlockServer{stream}) 359 } 360 361 type Mining_OnMinedBlockServer interface { 362 Send(*OnMinedBlockReply) error 363 grpc.ServerStream 364 } 365 366 type miningOnMinedBlockServer struct { 367 grpc.ServerStream 368 } 369 370 func (x *miningOnMinedBlockServer) Send(m *OnMinedBlockReply) error { 371 return x.ServerStream.SendMsg(m) 372 } 373 374 func _Mining_OnPendingLogs_Handler(srv interface{}, stream grpc.ServerStream) error { 375 m := new(OnPendingLogsRequest) 376 if err := stream.RecvMsg(m); err != nil { 377 return err 378 } 379 return srv.(MiningServer).OnPendingLogs(m, &miningOnPendingLogsServer{stream}) 380 } 381 382 type Mining_OnPendingLogsServer interface { 383 Send(*OnPendingLogsReply) error 384 grpc.ServerStream 385 } 386 387 type miningOnPendingLogsServer struct { 388 grpc.ServerStream 389 } 390 391 func (x *miningOnPendingLogsServer) Send(m *OnPendingLogsReply) error { 392 return x.ServerStream.SendMsg(m) 393 } 394 395 func _Mining_GetWork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 396 in := new(GetWorkRequest) 397 if err := dec(in); err != nil { 398 return nil, err 399 } 400 if interceptor == nil { 401 return srv.(MiningServer).GetWork(ctx, in) 402 } 403 info := &grpc.UnaryServerInfo{ 404 Server: srv, 405 FullMethod: Mining_GetWork_FullMethodName, 406 } 407 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 408 return srv.(MiningServer).GetWork(ctx, req.(*GetWorkRequest)) 409 } 410 return interceptor(ctx, in, info, handler) 411 } 412 413 func _Mining_SubmitWork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 414 in := new(SubmitWorkRequest) 415 if err := dec(in); err != nil { 416 return nil, err 417 } 418 if interceptor == nil { 419 return srv.(MiningServer).SubmitWork(ctx, in) 420 } 421 info := &grpc.UnaryServerInfo{ 422 Server: srv, 423 FullMethod: Mining_SubmitWork_FullMethodName, 424 } 425 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 426 return srv.(MiningServer).SubmitWork(ctx, req.(*SubmitWorkRequest)) 427 } 428 return interceptor(ctx, in, info, handler) 429 } 430 431 func _Mining_SubmitHashRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 432 in := new(SubmitHashRateRequest) 433 if err := dec(in); err != nil { 434 return nil, err 435 } 436 if interceptor == nil { 437 return srv.(MiningServer).SubmitHashRate(ctx, in) 438 } 439 info := &grpc.UnaryServerInfo{ 440 Server: srv, 441 FullMethod: Mining_SubmitHashRate_FullMethodName, 442 } 443 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 444 return srv.(MiningServer).SubmitHashRate(ctx, req.(*SubmitHashRateRequest)) 445 } 446 return interceptor(ctx, in, info, handler) 447 } 448 449 func _Mining_HashRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 450 in := new(HashRateRequest) 451 if err := dec(in); err != nil { 452 return nil, err 453 } 454 if interceptor == nil { 455 return srv.(MiningServer).HashRate(ctx, in) 456 } 457 info := &grpc.UnaryServerInfo{ 458 Server: srv, 459 FullMethod: Mining_HashRate_FullMethodName, 460 } 461 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 462 return srv.(MiningServer).HashRate(ctx, req.(*HashRateRequest)) 463 } 464 return interceptor(ctx, in, info, handler) 465 } 466 467 func _Mining_Mining_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 468 in := new(MiningRequest) 469 if err := dec(in); err != nil { 470 return nil, err 471 } 472 if interceptor == nil { 473 return srv.(MiningServer).Mining(ctx, in) 474 } 475 info := &grpc.UnaryServerInfo{ 476 Server: srv, 477 FullMethod: Mining_Mining_FullMethodName, 478 } 479 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 480 return srv.(MiningServer).Mining(ctx, req.(*MiningRequest)) 481 } 482 return interceptor(ctx, in, info, handler) 483 } 484 485 // Mining_ServiceDesc is the grpc.ServiceDesc for Mining service. 486 // It's only intended for direct use with grpc.RegisterService, 487 // and not to be introspected or modified (even as a copy) 488 var Mining_ServiceDesc = grpc.ServiceDesc{ 489 ServiceName: "txpool.Mining", 490 HandlerType: (*MiningServer)(nil), 491 Methods: []grpc.MethodDesc{ 492 { 493 MethodName: "Version", 494 Handler: _Mining_Version_Handler, 495 }, 496 { 497 MethodName: "GetWork", 498 Handler: _Mining_GetWork_Handler, 499 }, 500 { 501 MethodName: "SubmitWork", 502 Handler: _Mining_SubmitWork_Handler, 503 }, 504 { 505 MethodName: "SubmitHashRate", 506 Handler: _Mining_SubmitHashRate_Handler, 507 }, 508 { 509 MethodName: "HashRate", 510 Handler: _Mining_HashRate_Handler, 511 }, 512 { 513 MethodName: "Mining", 514 Handler: _Mining_Mining_Handler, 515 }, 516 }, 517 Streams: []grpc.StreamDesc{ 518 { 519 StreamName: "OnPendingBlock", 520 Handler: _Mining_OnPendingBlock_Handler, 521 ServerStreams: true, 522 }, 523 { 524 StreamName: "OnMinedBlock", 525 Handler: _Mining_OnMinedBlock_Handler, 526 ServerStreams: true, 527 }, 528 { 529 StreamName: "OnPendingLogs", 530 Handler: _Mining_OnPendingLogs_Handler, 531 ServerStreams: true, 532 }, 533 }, 534 Metadata: "txpool/mining.proto", 535 }