Documentation
¶
Index ¶
- Variables
- func DecodeSignatureScript(bs []byte) (uint32, string)
- func NewPowObject(powBlockInfo *PowBlockInfo) *powObject
- func SetGlobPowPoolInst(pool *PowPool) bool
- type Options
- type PowBlockEvent
- type PowBlockInfo
- type PowPool
- func (p *PowPool) Add(newPowBlockInfo *PowBlockInfo) error
- func (p *PowPool) Close()
- func (pool *PowPool) GetCurCoef() (curCoef int64)
- func (p *PowPool) GetPowDecision() (bool, *PowResult)
- func (p *PowPool) GetStatus() PowPoolStatus
- func (p *PowPool) InitialAddKframe(newPowBlockInfo *PowBlockInfo) error
- func (p *PowPool) Remove(powID meter.Bytes32) bool
- func (p *PowPool) ReplayFrom(startHeight int32) error
- func (p *PowPool) SubscribePowBlockEvent(ch chan *PowBlockEvent) event.Subscription
- func (p *PowPool) VerifyNPowBlockPerEpoch() bool
- func (p *PowPool) Wash() error
- type PowPoolStatus
- type PowResult
- type PowReward
- type RPCData
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrIncompletePowBlocksInEpoch = errors.New("incomplete pow blocks in epoch")
)
Functions ¶
func DecodeSignatureScript ¶
scriptSig contains 4 segments: encoded Height (vaired length) + Seqence (4 bytes) + TimeStamp (8 bytes) + Beneficiary str(40 bytes) + Optional(pool tag) only returns height, beneficairy as items[0],[3]
func NewPowObject ¶
func NewPowObject(powBlockInfo *PowBlockInfo) *powObject
func SetGlobPowPoolInst ¶
Types ¶
type Options ¶
type Options struct {
Node string
Port int
User string
Pass string
Limit int
LimitPerAccount int
MaxLifetime time.Duration
}
Options options for tx pool.
type PowBlockEvent ¶
type PowBlockEvent struct {
BlockInfo *PowBlockInfo
}
PowBlockEvent will be posted when pow is added or status changed.
type PowBlockInfo ¶
type PowBlockInfo struct {
// Pow header part
Version uint32
HashPrevBlock meter.Bytes32
HashMerkleRoot meter.Bytes32
Timestamp uint32
NBits uint32
Nonce uint32
HeaderHash meter.Bytes32
Beneficiary meter.Address
PowHeight uint32
// Raw block
PosRaw []byte
PowRaw []byte
}
func GetPowGenesisBlockInfo ¶
func GetPowGenesisBlockInfo() *PowBlockInfo
func NewPowBlockInfo ¶
func NewPowBlockInfo(raw []byte) *PowBlockInfo
func NewPowBlockInfoFromPosKBlock ¶
func NewPowBlockInfoFromPosKBlock(posBlock *block.Block) *PowBlockInfo
func NewPowBlockInfoFromPowBlock ¶
func NewPowBlockInfoFromPowBlock(powBlock *wire.MsgBlock) *PowBlockInfo
func (*PowBlockInfo) HashID ¶
func (info *PowBlockInfo) HashID() meter.Bytes32
func (*PowBlockInfo) ToString ¶
func (info *PowBlockInfo) ToString() string
type PowPool ¶
type PowPool struct {
// contains filtered or unexported fields
}
PowPool maintains unprocessed transactions.
var (
GlobPowPoolInst *PowPool
)
func GetGlobPowPoolInst ¶
func GetGlobPowPoolInst() *PowPool
func (*PowPool) Add ¶
func (p *PowPool) Add(newPowBlockInfo *PowBlockInfo) error
Add add new pow block into pool. It's not assumed as an error if the pow to be added is already in the pool,
func (*PowPool) GetCurCoef ¶ added in v1.2.0
func (*PowPool) GetPowDecision ¶
consensus APIs
func (*PowPool) GetStatus ¶ added in v1.2.0
func (p *PowPool) GetStatus() PowPoolStatus
func (*PowPool) InitialAddKframe ¶
func (p *PowPool) InitialAddKframe(newPowBlockInfo *PowBlockInfo) error
func (*PowPool) ReplayFrom ¶
func (*PowPool) SubscribePowBlockEvent ¶
func (p *PowPool) SubscribePowBlockEvent(ch chan *PowBlockEvent) event.Subscription
SubscribePowBlockEvent receivers will receive a pow
func (*PowPool) VerifyNPowBlockPerEpoch ¶ added in v1.2.0
type PowPoolStatus ¶ added in v1.2.0
type PowResult ¶
type PowResult struct {
Nonce uint32
Rewards []PowReward
Difficaulties *big.Int
Raw []block.PowRawBlock
}
pow decisions
func NewPowResult ¶
==============APIs for consensus ===================
Source Files
¶
Click to show internal directories.
Click to hide internal directories.