github.com/cranelv/ethereum_mpc@v0.0.0-20191031014521-23aeb1415092/consensus_pbft/consensusInterface/node.go (about) 1 package consensusInterface 2 3 import ( 4 "github.com/ethereum/go-ethereum/consensus_pbft/pbftTypes" 5 "github.com/ethereum/go-ethereum/consensus_pbft/message" 6 ) 7 8 type NodeInterface interface { 9 // Sign signs msg with this validator's signing key and outputs 10 // the signature if no error occurred. 11 Sign(msg []byte) ([]byte, error) 12 Verify(peerID *pbftTypes.PeerID, signature []byte, message []byte) error 13 14 } 15 type ValidatorIdentifyInterface interface{ 16 GetValidatorID(handle *pbftTypes.PeerID) (pbftTypes.ReplicaID, error) 17 GetValidatorNodeId(id pbftTypes.ReplicaID) (*pbftTypes.PeerID,error) 18 GetValidatorNodeIds(ids []pbftTypes.ReplicaID) ([]*pbftTypes.PeerID,error) 19 GetValidatorNode(id pbftTypes.ReplicaID) (pbftTypes.Peer,error) 20 GetValidatorNodes(ids []pbftTypes.ReplicaID) ([]pbftTypes.Peer,error) 21 } 22 23 // LegacyExecutor is used to invoke transactions, potentially modifying the backing ledger 24 type NodeExecutor interface { 25 BeginTaskBatch(id interface{}) error 26 ExecTasks(id interface{}, txs []*message.Task) ([]*message.Result, error) 27 CommitTaskBatch(id interface{}, metadata []byte) (*message.StateInfo, error) 28 RollbackTaskBatch(id interface{}) error 29 PreviewCommitTaskBatch(id interface{}, metadata []byte) ([]byte, error) 30 }