Documentation ¶
Index ¶
- func CalculateAvgBaseTarget(chain consensus.ChainReader, from consensus.Header, offset uint32) (*big.Int, consensus.Header)
- func CalculateBaseTarget(chain consensus.ChainReader, prev consensus.Header, poc *Poc) *big.Int
- func CalculateDeadline(genSig types.Byte32, scoopData types.Byte64, lastBaseTarget uint64) *big.Int
- func CalculateDeadlineByHit(hit *big.Int, lastBaseTarget uint64) *big.Int
- func CalculateDifficulty(baseTarget *big.Int) *big.Int
- func CalculateGenerationSignature(lastGenSig types.Byte32, lastGenId uint64) types.Byte32
- func CalculateHit(genSig types.Byte32, scoopData types.Byte64) *big.Int
- func CalculateScoop(genSig types.Byte32, height uint64) int32
- type Config
- type ConsensusData
- func (z *ConsensusData) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ConsensusData) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ConsensusData) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ConsensusData) Msgsize() (s int)
- func (self ConsensusData) String() string
- func (self *ConsensusData) UnWrap(oriConsensusData []byte) error
- func (z *ConsensusData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (self *ConsensusData) Wrap() ([]byte, error)
- type Genenis
- type Poc
- func (self Poc) Forge(chain consensus.ChainReader, header consensus.Header) (consensus.Data, error)
- func (self Poc) VerifyForge(chain consensus.ChainReader, header consensus.Header) error
- func (self Poc) VerifyHeader(chain consensus.ChainReader, header consensus.Header) error
- func (self Poc) VerifyHeaderWithoutForge(chain consensus.ChainReader, header consensus.Header) error
- type SimplePlotter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateAvgBaseTarget ¶
func CalculateBaseTarget ¶
func CalculateDeadline ¶
baseTarget from prev header !!
func CalculateDeadlineByHit ¶
Types ¶
type Config ¶
type Config struct { AvgBaseTargetNum uint32 ConsensusInterval uint32 MaxBaseTarget uint64 Gen Genenis }
func (*Config) GetGenesisConsensusData ¶
type ConsensusData ¶
type ConsensusData struct { GenerationSignature types.Byte32 `json: "generationSignature"` Nonce uint64 `json: "nonce"` GenId uint64 `json: "genId"` BaseTarget *types.BigInt `json: "baseTarget"` Deadline *types.BigInt `msg:"-" json: "deadline"` }
func GetConsensusDataFromHeader ¶
func GetConsensusDataFromHeader(header consensus.Header) (*ConsensusData, error)
func (*ConsensusData) DecodeMsg ¶
func (z *ConsensusData) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ConsensusData) EncodeMsg ¶
func (z *ConsensusData) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ConsensusData) MarshalMsg ¶
func (z *ConsensusData) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ConsensusData) Msgsize ¶
func (z *ConsensusData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (ConsensusData) String ¶
func (self ConsensusData) String() string
func (*ConsensusData) UnWrap ¶
func (self *ConsensusData) UnWrap(oriConsensusData []byte) error
func (*ConsensusData) UnmarshalMsg ¶
func (z *ConsensusData) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (*ConsensusData) Wrap ¶
func (self *ConsensusData) Wrap() ([]byte, error)
type Poc ¶
type Poc struct {
Config
}
Currently only support poc2 !!!
func (Poc) VerifyForge ¶
func (Poc) VerifyHeader ¶
func (Poc) VerifyHeaderWithoutForge ¶
type SimplePlotter ¶
type SimplePlotter struct {
// contains filtered or unexported fields
}
func (*SimplePlotter) PlotPoC1 ¶
func (self *SimplePlotter) PlotPoC1(addr uint64, nonce uint64)
func (*SimplePlotter) PlotPoC2 ¶
func (self *SimplePlotter) PlotPoC2(addr uint64, nonce uint64)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.