Documentation ¶
Index ¶
- Constants
- Variables
- func RequestToDuration(req string, now time.Time) (time.Duration, error)
- type ApplicationService
- type Assets
- type Collateral
- type NullBlockchain
- func (n *NullBlockchain) BeginBlock() *NullBlockchain
- func (n *NullBlockchain) CheckTransaction(ctx context.Context, tx []byte) (*tmctypes.ResultCheckTx, error)
- func (n *NullBlockchain) EndBlock() *NullBlockchain
- func (n *NullBlockchain) ForwardTime(d time.Duration)
- func (n *NullBlockchain) GenesisValidators(_ context.Context) ([]*tmtypes.Validator, error)
- func (n *NullBlockchain) GetChainID(context.Context) (string, error)
- func (n *NullBlockchain) GetGenesisTime(context.Context) (time.Time, error)
- func (n *NullBlockchain) GetNetworkInfo(context.Context) (*tmctypes.ResultNetInfo, error)
- func (n *NullBlockchain) GetStatus(context.Context) (*tmctypes.ResultStatus, error)
- func (n *NullBlockchain) GetUnconfirmedTxCount(context.Context) (int, error)
- func (n *NullBlockchain) Health(_ context.Context) (*tmctypes.ResultHealth, error)
- func (n *NullBlockchain) InitChain() error
- func (n *NullBlockchain) ReloadConf(cfg blockchain.Config)
- func (n *NullBlockchain) SendTransactionAsync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
- func (n *NullBlockchain) SendTransactionCommit(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTxCommit, error)
- func (n *NullBlockchain) SendTransactionSync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
- func (n *NullBlockchain) SetABCIApp(app ApplicationService)
- func (n *NullBlockchain) Start() error
- func (n *NullBlockchain) StartChain() error
- func (n *NullBlockchain) StartServer() error
- func (n *NullBlockchain) Stop() error
- func (n *NullBlockchain) Subscribe(context.Context, func(tmctypes.ResultEvent) error, ...string) error
- func (n *NullBlockchain) Validators(_ context.Context, _ *int64) ([]*tmtypes.Validator, error)
- type Replayer
- type StakingLoop
- type TimeService
Constants ¶
View Source
const ( NullChainStatusReady = "chain-ready" NullChainStatusReplaying = "chain-replaying" )
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented for nullblockchain") ErrChainReplaying = errors.New("nullblockchain is replaying") ErrGenesisFileRequired = errors.New("--blockchain.nullchain.genesis-file is required") )
View Source
var ErrInvalidRequest = errors.New("invalid request")
View Source
var ErrReplayFileIsRequired = errors.New("replay-file is required when replay/record is enabled")
Functions ¶
Types ¶
type ApplicationService ¶
type ApplicationService interface { InitChain(res abci.RequestInitChain) (resp abci.ResponseInitChain) BeginBlock(req abci.RequestBeginBlock) (resp abci.ResponseBeginBlock) EndBlock(req abci.RequestEndBlock) (resp abci.ResponseEndBlock) Commit() (resp abci.ResponseCommit) DeliverTx(req abci.RequestDeliverTx) (resp abci.ResponseDeliverTx) Info(req abci.RequestInfo) (resp abci.ResponseInfo) }
type Collateral ¶
type NullBlockchain ¶
type NullBlockchain struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient( log *logging.Logger, cfg blockchain.NullChainConfig, timeService TimeService, ) *NullBlockchain
func (*NullBlockchain) BeginBlock ¶
func (n *NullBlockchain) BeginBlock() *NullBlockchain
func (*NullBlockchain) CheckTransaction ¶
func (n *NullBlockchain) CheckTransaction(ctx context.Context, tx []byte) (*tmctypes.ResultCheckTx, error)
func (*NullBlockchain) EndBlock ¶
func (n *NullBlockchain) EndBlock() *NullBlockchain
func (*NullBlockchain) ForwardTime ¶
func (n *NullBlockchain) ForwardTime(d time.Duration)
ForwardTime moves the chain time forward by the given duration, delivering any pending transaction and creating any extra empty blocks if time is stepped forward by more than a block duration.
func (*NullBlockchain) GenesisValidators ¶
func (*NullBlockchain) GetChainID ¶
func (n *NullBlockchain) GetChainID(context.Context) (string, error)
func (*NullBlockchain) GetGenesisTime ¶
func (*NullBlockchain) GetNetworkInfo ¶
func (n *NullBlockchain) GetNetworkInfo(context.Context) (*tmctypes.ResultNetInfo, error)
func (*NullBlockchain) GetStatus ¶
func (n *NullBlockchain) GetStatus(context.Context) (*tmctypes.ResultStatus, error)
func (*NullBlockchain) GetUnconfirmedTxCount ¶
func (n *NullBlockchain) GetUnconfirmedTxCount(context.Context) (int, error)
func (*NullBlockchain) Health ¶
func (n *NullBlockchain) Health(_ context.Context) (*tmctypes.ResultHealth, error)
func (*NullBlockchain) InitChain ¶
func (n *NullBlockchain) InitChain() error
InitChain processes the given genesis file setting the chain's time, and passing the appstate through to the processors InitChain.
func (*NullBlockchain) ReloadConf ¶
func (n *NullBlockchain) ReloadConf(cfg blockchain.Config)
ReloadConf update the internal configuration.
func (*NullBlockchain) SendTransactionAsync ¶
func (n *NullBlockchain) SendTransactionAsync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
func (*NullBlockchain) SendTransactionCommit ¶
func (n *NullBlockchain) SendTransactionCommit(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTxCommit, error)
func (*NullBlockchain) SendTransactionSync ¶
func (n *NullBlockchain) SendTransactionSync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
func (*NullBlockchain) SetABCIApp ¶
func (n *NullBlockchain) SetABCIApp(app ApplicationService)
func (*NullBlockchain) Start ¶
func (n *NullBlockchain) Start() error
func (*NullBlockchain) StartChain ¶
func (n *NullBlockchain) StartChain() error
func (*NullBlockchain) StartServer ¶
func (n *NullBlockchain) StartServer() error
func (*NullBlockchain) Stop ¶
func (n *NullBlockchain) Stop() error
func (*NullBlockchain) Subscribe ¶
func (n *NullBlockchain) Subscribe(context.Context, func(tmctypes.ResultEvent) error, ...string) error
func (*NullBlockchain) Validators ¶
type Replayer ¶
type Replayer struct {
// contains filtered or unexported fields
}
func NewNullChainReplayer ¶
func NewNullChainReplayer(app ApplicationService, cfg blockchain.ReplayConfig, log *logging.Logger) (*Replayer, error)
func (*Replayer) InitChain ¶
func (r *Replayer) InitChain(req abci.RequestInitChain) (resp abci.ResponseInitChain)
type StakingLoop ¶
type StakingLoop struct {
// contains filtered or unexported fields
}
func NewStakingLoop ¶
func NewStakingLoop(col Collateral, assets Assets) *StakingLoop
NewStakingLoop return a type that can "mock" a StakingAccount by instead reading deposited amounts from the collateral engine. Used by the null-blockchain to remove the need for an Ethereum connection.
func (*StakingLoop) GetAvailableBalance ¶
func (s *StakingLoop) GetAvailableBalance(party string) (*num.Uint, error)
func (*StakingLoop) GetAvailableBalanceInRange ¶
func (*StakingLoop) GetStakingAssetTotalSupply ¶
func (s *StakingLoop) GetStakingAssetTotalSupply() *num.Uint
type TimeService ¶
Click to show internal directories.
Click to hide internal directories.