Documentation ¶
Index ¶
- type ConnManager
- type ShardBackend
- func (s *ShardBackend) AddBlockListForSync(blockLst []*types.MinorBlock) error
- func (s *ShardBackend) AddMinorBlock(block *types.MinorBlock) error
- func (s *ShardBackend) AddRootBlock(rBlock *types.RootBlock) (switched bool, err error)
- func (s *ShardBackend) CreateBlockToMine() (types.IBlock, error)
- func (s *ShardBackend) GenTx(genTxs *rpc.GenTxRequest) error
- func (s *ShardBackend) GetLogs(start uint64, end uint64, address []account.Address, topics [][]common.Hash) ([]*types.Log, error)
- func (s *ShardBackend) GetMinorBlock(mHash common.Hash, height *uint64) *types.MinorBlock
- func (s *ShardBackend) GetTip() uint64
- func (s *ShardBackend) GetTransactionListByAddress(address *account.Address, start []byte, limit uint32) ([]*rpc.TransactionDetail, []byte, error)
- func (s *ShardBackend) GetUnconfirmedHeaderList() ([]*types.MinorBlockHeader, error)
- func (s *ShardBackend) GetWork() (*consensus.MiningWork, error)
- func (s *ShardBackend) HandleNewTip(rBHeader *types.RootBlockHeader, mBHeader *types.MinorBlockHeader, ...) error
- func (s *ShardBackend) InitFromRootBlock(rBlock *types.RootBlock) error
- func (s *ShardBackend) InsertMinedBlock(block types.IBlock) error
- func (s *ShardBackend) NewMinorBlock(block *types.MinorBlock) (err error)
- func (s *ShardBackend) PoswDiffAdjust(block *types.MinorBlock) (*big.Int, error)
- func (s *ShardBackend) SetMining(mining bool)
- func (s *ShardBackend) Stop()
- func (s *ShardBackend) SubmitWork(headerHash common.Hash, nonce uint64, mixHash common.Hash) error
- type TxGenerator
- type XshardListTuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnManager ¶
type ConnManager interface { BroadcastXshardTxList(block *types.MinorBlock, xshardTxList []*types.CrossShardTransactionDeposit, height uint32) error SendMinorBlockHeaderToMaster(minorHeader *types.MinorBlockHeader, txLen, xshardLen uint32, state *rpc.ShardStatus) error BatchBroadcastXshardTxList(blokHshToXLstAdPrvRotHg map[common.Hash]*XshardListTuple, sorBrch account.Branch) error // p2p interface BroadcastNewTip(mHeaderLst []*types.MinorBlockHeader, rHeader *types.RootBlockHeader, branch uint32) error BroadcastTransactions(txs []*types.Transaction, branch uint32) error BroadcastMinorBlock(minorBlock *types.MinorBlock, branch uint32) error GetMinorBlocks(mHeaderList []common.Hash, peerId string, branch uint32) ([]*types.MinorBlock, error) GetMinorBlockHeaders(*rpc.GetMinorBlockHeaderListRequest) ([]*types.MinorBlockHeader, error) }
type ShardBackend ¶
type ShardBackend struct { Config *config.ShardConfig MinorBlockChain *core.MinorBlockChain // contains filtered or unexported fields }
func New ¶
func New(ctx *service.ServiceContext, rBlock *types.RootBlock, conn ConnManager, cfg *config.ClusterConfig, fullshardId uint32) (*ShardBackend, error)
func (*ShardBackend) AddBlockListForSync ¶
func (s *ShardBackend) AddBlockListForSync(blockLst []*types.MinorBlock) error
Add blocks in batch to reduce RPCs. Will NOT broadcast to peers.
Returns true if blocks are successfully added. False on any error. This function only adds blocks to local and propagate xshard list to other shards. It does NOT notify master because the master should already have the minor header list, and will add them once this function returns successfully.
func (*ShardBackend) AddMinorBlock ¶
func (s *ShardBackend) AddMinorBlock(block *types.MinorBlock) error
Returns true if block is successfully added. False on any error. called by 1. local miner (will not run if syncing) 2. SyncTask
func (*ShardBackend) AddRootBlock ¶
func (s *ShardBackend) AddRootBlock(rBlock *types.RootBlock) (switched bool, err error)
func (*ShardBackend) CreateBlockToMine ¶
func (s *ShardBackend) CreateBlockToMine() (types.IBlock, error)
miner api
func (*ShardBackend) GenTx ¶
func (s *ShardBackend) GenTx(genTxs *rpc.GenTxRequest) error
func (*ShardBackend) GetLogs ¶
func (s *ShardBackend) GetLogs(start uint64, end uint64, address []account.Address, topics [][]common.Hash) ([]*types.Log, error)
TODO 当前版本暂不添加
func (*ShardBackend) GetMinorBlock ¶
func (s *ShardBackend) GetMinorBlock(mHash common.Hash, height *uint64) *types.MinorBlock
func (*ShardBackend) GetTip ¶
func (s *ShardBackend) GetTip() uint64
func (*ShardBackend) GetTransactionListByAddress ¶
func (s *ShardBackend) GetTransactionListByAddress(address *account.Address, start []byte, limit uint32) ([]*rpc.TransactionDetail, []byte, error)
func (*ShardBackend) GetUnconfirmedHeaderList ¶
func (s *ShardBackend) GetUnconfirmedHeaderList() ([]*types.MinorBlockHeader, error)
func (*ShardBackend) GetWork ¶
func (s *ShardBackend) GetWork() (*consensus.MiningWork, error)
func (*ShardBackend) HandleNewTip ¶
func (s *ShardBackend) HandleNewTip(rBHeader *types.RootBlockHeader, mBHeader *types.MinorBlockHeader, peerID string) error
func (*ShardBackend) InitFromRootBlock ¶
func (s *ShardBackend) InitFromRootBlock(rBlock *types.RootBlock) error
Either recover state from local db or create genesis state based on config
func (*ShardBackend) InsertMinedBlock ¶
func (s *ShardBackend) InsertMinedBlock(block types.IBlock) error
func (*ShardBackend) NewMinorBlock ¶
func (s *ShardBackend) NewMinorBlock(block *types.MinorBlock) (err error)
func (*ShardBackend) PoswDiffAdjust ¶
func (s *ShardBackend) PoswDiffAdjust(block *types.MinorBlock) (*big.Int, error)
func (*ShardBackend) SetMining ¶
func (s *ShardBackend) SetMining(mining bool)
func (*ShardBackend) Stop ¶
func (s *ShardBackend) Stop()
func (*ShardBackend) SubmitWork ¶
type TxGenerator ¶
type TxGenerator struct {
// contains filtered or unexported fields
}
func NewTxGenerator ¶
func NewTxGenerator(genesisDir string, fullShardId uint32, cfg *config.QuarkChainConfig) *TxGenerator
func (*TxGenerator) Generate ¶
func (t *TxGenerator) Generate(genTxs *rpc.GenTxRequest, addTxList func(txs []*types.Transaction) error) error
type XshardListTuple ¶
type XshardListTuple struct { XshardTxList []*types.CrossShardTransactionDeposit PrevRootHeight uint32 }
Click to show internal directories.
Click to hide internal directories.