Documentation ¶
Overview ¶
Package blockchain
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Package blockchain ¶
@author: xwc1125
Index ¶
- Variables
- func NewBlockRW(reader protocol.BlockReader, writer protocol.BlockWriter) (protocol.BlockReadWriter, error)
- func NewBlockReader(config protocol.Config, database protocol.Database, apis protocol.APIs) (protocol.BlockReader, error)
- func NewBlockWriter(reader protocol.BlockReader, engine protocol.Consensus, apps protocol.Apps) *blockWriter
- func RPCMarshalBlock(ctx context.Context, b *models.Block) (map[string]interface{}, error)
- type API
- func (api *API) BlockHeight(ctx context.Context) hexutil.Uint64
- func (api *API) GetBlockByHash(ctx context.Context, blockHash types.Hash) (map[string]interface{}, error)
- func (api *API) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (map[string]interface{}, error)
- func (api *API) GetBlockTransactionCountByHash(ctx context.Context, blockHash types.Hash) *hexutil.Uint
- func (api *API) NewHeads(ctx context.Context) (*rpc.Subscription, error)
- type WhCallback
- type WriteStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var BadHashes = map[types.Hash]bool{}
BadHashes 硬分叉的hash
View Source
var (
ErrFutureBlock = errors.New("block in the future")
)
Functions ¶
func NewBlockRW ¶
func NewBlockRW(reader protocol.BlockReader, writer protocol.BlockWriter) (protocol.BlockReadWriter, error)
NewBlockRW 创建block读写对象
func NewBlockReader ¶
func NewBlockReader(config protocol.Config, database protocol.Database, apis protocol.APIs) (protocol.BlockReader, error)
NewBlockReader 创建区块链服务
func NewBlockWriter ¶
func NewBlockWriter(reader protocol.BlockReader, engine protocol.Consensus, apps protocol.Apps) *blockWriter
NewBlockWriter 创建blockWriter
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func NewAPI ¶
func NewAPI(bc protocol.BlockReader) *API
func (*API) GetBlockByHash ¶
func (*API) GetBlockByNumber ¶
func (*API) GetBlockTransactionCountByHash ¶
type WriteStatus ¶
type WriteStatus byte
WriteStatus 写的状态
const ( NonStatTy WriteStatus = iota CanonicalStatTy // 标准状态 SideStatTy // 侧链状态 )
Click to show internal directories.
Click to hide internal directories.