satoshiplus

package
v0.0.0-...-7ee7fde Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryFlag

type HistoryFlag byte
const (
	// CacheSize represents the size of cache for round validators.
	CacheSize = 8

	ExistFlag HistoryFlag = 1
	SaveFlag  HistoryFlag = 2
	NoneFlag  HistoryFlag = 0
)

type RoundManager

type RoundManager struct {
	// contains filtered or unexported fields
}

func NewRoundManager

func NewRoundManager() *RoundManager

create a new round maganger

func (*RoundManager) GetContract

func (m *RoundManager) GetContract() common.Address

return unique contract code which represents some consensus

func (*RoundManager) GetHsMappingByRound

func (m *RoundManager) GetHsMappingByRound(round uint32) (map[string]*ainterface.ValidatorInfo, error)

func (*RoundManager) GetMinersByRound

func (m *RoundManager) GetMinersByRound(round uint32) (map[string]float64, error)

get miners of round the return value is a map (key (miner) -> value (count per collect interval))

func (*RoundManager) GetNextRound

func (m *RoundManager) GetNextRound(round *ainterface.Round) (*ainterface.Round, error)

return the next round.

func (*RoundManager) GetRoundInterval

func (m *RoundManager) GetRoundInterval(round int64) int64

get special round interval

func (*RoundManager) GetValidators

func (m *RoundManager) GetValidators(blockHash common.Hash, round uint32, fn ainterface.GetValidatorsCallBack) (
	[]*common.Address, map[common.Address]uint16, error)

Get validators for special round.

func (*RoundManager) Halt

func (m *RoundManager) Halt()

func (*RoundManager) HasValidator

func (m *RoundManager) HasValidator(validator common.Address) bool

return true if the given validator may be valid, other wise false.

func (*RoundManager) Init

initialize round manager.

func (*RoundManager) Start

func (m *RoundManager) Start()

type RoundMinerInfo

type RoundMinerInfo struct {
	// contains filtered or unexported fields
}

type RoundValidators

type RoundValidators struct {
	// contains filtered or unexported fields
}

type SPService

type SPService struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Prove of SatoshiPlus. using round robin algorithm to generate blocks with orders in the list of authority peers. this consensus depends on bitcoin's miner. please refer to the white paper of asimov.

func NewSatoshiPlusService

func NewSatoshiPlusService(config *params.Config) (*SPService, error)

Create SatoshiPlus Service

func (*SPService) GetRoundInterval

func (s *SPService) GetRoundInterval() int64

return round interval currently

func (*SPService) Halt

func (s *SPService) Halt() error

Halt SatoshiPlus service goroutine

func (*SPService) Start

func (s *SPService) Start() error

Start SatoshiPlus Service, it create a goroutine and check mining on blockTimer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL