prysm-pulse/beacon-chain/rpc/attester_server.go
Raul Jordan 4c46b02dac
Deprecating Old RPC Methods (#1410)
* begin reorder

* move into beacon server

* add proposer server

* fix

* add proposer server

* wrap up rpc reorder

* eliminated deprecated RPC endpoints

* formatted nicely

* RPC protos

* fix lint

* integrate hash proto

* autoclean

* deprecate all old code

* include the rest of methods mocks

* bazel run

* lint fixes
2019-01-28 20:41:04 +01:00

28 lines
987 B
Go

package rpc
import (
"context"
"fmt"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/hashutil"
)
// AttesterServer defines a server implementation of the gRPC Attester service,
// providing RPC methods for validators acting as attesters to broadcast votes on beacon blocks.
type AttesterServer struct {
attestationService attestationService
}
// AttestHead is a function called by an attester in a sharding validator to vote
// on a block via an attestation object as defined in the Ethereum Serenity specification.
func (as *AttesterServer) AttestHead(ctx context.Context, req *pb.AttestRequest) (*pb.AttestResponse, error) {
h, err := hashutil.HashProto(req.Attestation)
if err != nil {
return nil, fmt.Errorf("could not hash attestation: %v", err)
}
// Relays the attestation to chain service.
as.attestationService.IncomingAttestationFeed().Send(req.Attestation)
return &pb.AttestResponse{AttestationHash: h[:]}, nil
}