modules

package
v0.0.0-...-4caad46 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Hash string

	PreviousHash string
	Number       string
	MerkleRoot   string
	Miner        string
	Ts           string

	Transactions []*Transaction.Transaction
	Signature    string
}

func (*Block) LoadFromInterface

func (b *Block) LoadFromInterface(obj interface{}) error

func (*Block) LoadFromJSONString

func (b *Block) LoadFromJSONString(jsonString string) error

func (*Block) PackToJSONString

func (b *Block) PackToJSONString() string

func (*Block) Sign

func (b *Block) Sign(privateKey string) error

type ConsensusStorageData

type ConsensusStorageData interface {
	LoadFromJSONString(jsonString string) error
	LoadFromInterface(obj interface{}) error
}

type WorldStatus

type WorldStatus struct {

	// 状态
	Hackers     []*Transaction.Hacker
	Enterprises []*Transaction.Enterprise
	Experts     []*Transaction.Expert
	Tasks       []*Transaction.Task
	// 关联状态
	TaskHackers []*Transaction.TaskHacker

	// HardCode for test
	Miners []string

	// 共识参数
	Reputations map[string]float64
	// contains filtered or unexported fields
}

链上数据的实时世界状态

func (*WorldStatus) AddNewLocalBlock

func (w *WorldStatus) AddNewLocalBlock(block *Block)

func (*WorldStatus) Build

func (w *WorldStatus) Build(config map[string]string)

func (*WorldStatus) FetchAllBlocks

func (w *WorldStatus) FetchAllBlocks()

拉取线上所有区块。因为不是每次构建都需要全量拉取,所以要独立封装出来

func (*WorldStatus) FetchWorldStatus

func (w *WorldStatus) FetchWorldStatus() error

获取节点上构建好的世界状态,并构建本地状态

func (*WorldStatus) GetLocalTopBlock

func (w *WorldStatus) GetLocalTopBlock() *Block

func (*WorldStatus) GetRemoteIntentionRankCache

func (w *WorldStatus) GetRemoteIntentionRankCache(term string) ([]*ConsensusModules.IntentionRank, error)

拉取节点上的缓存打包意向排行榜

func (*WorldStatus) GetRemotePackageIntentionCache

func (w *WorldStatus) GetRemotePackageIntentionCache(term string) ([]*ConsensusModules.PackageIntention, error)

拉取节点上的缓存打包意向信息

func (*WorldStatus) GetRemoteTopBlock

func (w *WorldStatus) GetRemoteTopBlock() *Block

func (*WorldStatus) GetRemoteTransactionCache

func (w *WorldStatus) GetRemoteTransactionCache() ([]*Transaction.Transaction, error)

拉取缓存数据,用于构建区块

func (*WorldStatus) GetWorldStatus

func (w *WorldStatus) GetWorldStatus() map[string]interface{}

以对象形式返回一个世界状态

func (*WorldStatus) PackToJSONString

func (w *WorldStatus) PackToJSONString() string

把世界状态打包成JSON格式数据

Directories

Path Synopsis
Utils
btcec
Package btcec implements support for the elliptic curves needed for bitcoin.
Package btcec implements support for the elliptic curves needed for bitcoin.

Jump to

Keyboard shortcuts

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