github.com/reapchain/go-reapchain@v0.2.15-0.20210609012950-9735c110c705/consensus/podc/backend.go (about)

     1  // Copyright 2017 AMIS Technologies
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package podc
    18  
    19  import (
    20  	"github.com/ethereum/go-ethereum/common"
    21  	"github.com/ethereum/go-ethereum/event"
    22  )
    23  
    24  // Backend provides application specific functions for Istanbul core
    25  type Backend interface {
    26  	// Address returns the owner's address
    27  	Address() common.Address
    28  
    29  	// Validators returns the validator set
    30  	Validators(proposal Proposal) ValidatorSet  // old istanbul method, I'll remove it in the future after debuging
    31  
    32  	// Validators returns the validator set
    33  	// EmptyValidators(proposal Proposal) string   // PoDC 상원, 하원,
    34  
    35  
    36  	// EventMux returns the event mux in backend
    37  	EventMux() *event.TypeMux
    38  
    39  	// Send sends a message to specific target : 특정 노드에 보낼때,
    40  	Send(payload []byte, target common.Address) error
    41  
    42  	// Broadcast sends a message to all validators : 전체 노드에 보낼때, 기 정의된 Validator집합에..
    43  	Broadcast(valSet ValidatorSet, payload []byte) error
    44  
    45  	// Multicast sends a message to specific targets
    46  	Multicast(payload []byte, targets []common.Address) error
    47  
    48  	// Commit delivers an approved proposal to backend.
    49  	// The delivered proposal will be put into blockchain.
    50  	Commit(proposal Proposal, seals []byte) error
    51  
    52  	// NextRound is called when we want to trigger next Seal()
    53  	NextRound() error
    54  
    55  	// Verify verifies the proposal.
    56  	Verify(Proposal) error
    57  
    58  	// Sign signs input data with the backend's private key
    59  	Sign([]byte) ([]byte, error)
    60  
    61  	// CheckSignature verifies the signature by checking if it's signed by
    62  	// the given validator
    63  	CheckSignature(data []byte, addr common.Address, sig []byte) error
    64  }
    65  
    66  //EmptyValidators(proposal Proposal) bool