Documentation
¶
Index ¶
- Constants
- Variables
- func AccumulateRewards(pubkey *secp256k1.PublicKey, trieStore store.StoreInterface, ...) error
- type SoloConfig
- type SoloConsensus
- type SoloConsensusService
- func (soloConsensusService *SoloConsensusService) Api() []app.API
- func (soloConsensusService *SoloConsensusService) CommandFlags() ([]cli.Command, []cli.Flag)
- func (soloConsensusService *SoloConsensusService) DefaultConfig() *SoloConfig
- func (soloConsensusService *SoloConsensusService) Init(executeContext *app.ExecuteContext) error
- func (soloConsensusService *SoloConsensusService) Name() string
- func (soloConsensusService *SoloConsensusService) Start(executeContext *app.ExecuteContext) error
- func (soloConsensusService *SoloConsensusService) Stop(executeContext *app.ExecuteContext) error
- type SoloValidator
Constants ¶
View Source
const (
MODULENAME = "solo"
)
Variables ¶
View Source
var ( ErrSignBlock = errors.New("sign block error") ErrWalletNotOpen = errors.New("wallet is close") ErrCheckSigFail = errors.New("verify sig in block fail") ErrGasUsed = errors.New("gasused not match") )
View Source
var (
EnableSoloConsensusFlag = cli.BoolFlag{
Name: "enable",
Usage: "enable solo consensus",
}
)
Functions ¶
func AccumulateRewards ¶
func AccumulateRewards(pubkey *secp256k1.PublicKey, trieStore store.StoreInterface, totalGasBalance *big.Int, height uint64) error
AccumulateRewards credits,The leader gets half of the reward and other ,Other participants get the average of the other half
Types ¶
type SoloConfig ¶
type SoloConsensus ¶
type SoloConsensus struct { CoinBase crypto.CommonAddress PrivKey *secp256k1.PrivateKey Pubkey *secp256k1.PublicKey ChainService chain.ChainServiceInterface DbService *database.DatabaseService // contains filtered or unexported fields }
func NewSoloConsensus ¶
func NewSoloConsensus( chainService chain.ChainServiceInterface, blockGenerator blockmgr.IBlockBlockGenerator, myPk *secp256k1.PublicKey, dbService *database.DatabaseService, config *SoloConfig) *SoloConsensus
func (*SoloConsensus) ReceiveMsg ¶
func (soloConsensus *SoloConsensus) ReceiveMsg(peer *consensusTypes.PeerInfo, t uint64, buf []byte)
func (*SoloConsensus) Run ¶
func (soloConsensus *SoloConsensus) Run(privKey *secp256k1.PrivateKey) (*types.Block, error)
type SoloConsensusService ¶
type SoloConsensusService struct { P2pServer p2pService.P2P `service:"p2p"` ChainService chainService.ChainServiceInterface `service:"chain"` BroadCastor blockMgrService.ISendMessage `service:"blockmgr"` BlockMgrNotifier blockMgrService.IBlockNotify `service:"blockmgr"` BlockGenerator blockMgrService.IBlockBlockGenerator `service:"blockmgr"` DatabaseService *database.DatabaseService `service:"database"` WalletService *accountService.AccountService `service:"accounts"` Config *SoloConfig ConsensusEngine consensusTypes.IConsensusEngine Miner *secp256k1.PrivateKey // contains filtered or unexported fields }
func (*SoloConsensusService) Api ¶
func (soloConsensusService *SoloConsensusService) Api() []app.API
func (*SoloConsensusService) CommandFlags ¶
func (soloConsensusService *SoloConsensusService) CommandFlags() ([]cli.Command, []cli.Flag)
func (*SoloConsensusService) DefaultConfig ¶
func (soloConsensusService *SoloConsensusService) DefaultConfig() *SoloConfig
func (*SoloConsensusService) Init ¶
func (soloConsensusService *SoloConsensusService) Init(executeContext *app.ExecuteContext) error
func (*SoloConsensusService) Name ¶
func (soloConsensusService *SoloConsensusService) Name() string
func (*SoloConsensusService) Start ¶
func (soloConsensusService *SoloConsensusService) Start(executeContext *app.ExecuteContext) error
func (*SoloConsensusService) Stop ¶
func (soloConsensusService *SoloConsensusService) Stop(executeContext *app.ExecuteContext) error
type SoloValidator ¶
type SoloValidator struct {
// contains filtered or unexported fields
}
func NewSoloValidator ¶
func NewSoloValidator(pubkey *secp256k1.PublicKey) *SoloValidator
func (*SoloValidator) ExecuteBlock ¶
func (soloValidator *SoloValidator) ExecuteBlock(context *chain.BlockExecuteContext) error
func (*SoloValidator) VerifyBody ¶
func (soloValidator *SoloValidator) VerifyBody(block *types.Block) error
func (*SoloValidator) VerifyHeader ¶
func (soloValidator *SoloValidator) VerifyHeader(header, parent *types.BlockHeader) error
Click to show internal directories.
Click to hide internal directories.