Documentation
¶
Overview ¶
Package clients implements interfaces for mainchain and sidechain clients.
The client interfaces wrap up the functionality required for the attestation of sidechain clients through a mainchain wallet.
Mock interfaces for unit-testing are also implemented.
Index ¶
- type SidechainClient
- type SidechainClientFake
- func (f *SidechainClientFake) Close()
- func (f *SidechainClientFake) Generate(height int32)
- func (f *SidechainClientFake) GetBestBlockHash() (*chainhash.Hash, error)
- func (f *SidechainClientFake) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)
- func (f *SidechainClientFake) GetBlockCount() (int64, error)
- func (f *SidechainClientFake) GetBlockHash(height int64) (*chainhash.Hash, error)
- func (f *SidechainClientFake) GetBlockHeight(hash *chainhash.Hash) (int32, error)
- func (f *SidechainClientFake) GetBlockTxs(hash *chainhash.Hash) ([]string, error)
- func (f *SidechainClientFake) GetTxBlockHash(hash *chainhash.Hash) (string, error)
- type SidechainClientOcean
- func (o *SidechainClientOcean) Close()
- func (o *SidechainClientOcean) GetBestBlockHash() (*chainhash.Hash, error)
- func (o *SidechainClientOcean) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)
- func (o *SidechainClientOcean) GetBlockCount() (int64, error)
- func (o *SidechainClientOcean) GetBlockHash(height int64) (*chainhash.Hash, error)
- func (o *SidechainClientOcean) GetBlockHeight(hash *chainhash.Hash) (int32, error)
- func (o *SidechainClientOcean) GetTxBlockHash(hash *chainhash.Hash) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SidechainClient ¶
type SidechainClient interface { GetBestBlockHash() (*chainhash.Hash, error) GetBlockHeight(*chainhash.Hash) (int32, error) GetBlockHash(int64) (*chainhash.Hash, error) GetBlock(*chainhash.Hash) (*wire.MsgBlock, error) GetTxBlockHash(*chainhash.Hash) (string, error) GetBlockCount() (int64, error) Close() }
SidechainClient interface Implements the interface for sidechain clients Current logic includes getting latest block from sidechain
type SidechainClientFake ¶
type SidechainClientFake struct {
// contains filtered or unexported fields
}
SidechainClientFake structure Implements fake implementation of SidechainClient for unit-testing
func NewSidechainClientFake ¶
func NewSidechainClientFake() *SidechainClientFake
SidechainClientFake returns new instance of a fake SidechainClient
func (*SidechainClientFake) Close ¶
func (f *SidechainClientFake) Close()
Close function - inherit - do nothing
func (*SidechainClientFake) Generate ¶
func (f *SidechainClientFake) Generate(height int32)
Generate function increments the latest height in the fake client
func (*SidechainClientFake) GetBestBlockHash ¶
func (f *SidechainClientFake) GetBestBlockHash() (*chainhash.Hash, error)
GetBestBlockHash returns latest block from fake blocks
func (*SidechainClientFake) GetBlockCount ¶
func (f *SidechainClientFake) GetBlockCount() (int64, error)
GetBlockCount returns number of blocks in fake client
func (*SidechainClientFake) GetBlockHash ¶
func (f *SidechainClientFake) GetBlockHash(height int64) (*chainhash.Hash, error)
GetBlockHash returns block hash of block from fake blocks
func (*SidechainClientFake) GetBlockHeight ¶
func (f *SidechainClientFake) GetBlockHeight(hash *chainhash.Hash) (int32, error)
GetBlockHeight returns block height of block from fake blocks
func (*SidechainClientFake) GetBlockTxs ¶
func (f *SidechainClientFake) GetBlockTxs(hash *chainhash.Hash) ([]string, error)
GetBlockTxs returns the fake txs for a fake block hash
func (*SidechainClientFake) GetTxBlockHash ¶
func (f *SidechainClientFake) GetTxBlockHash(hash *chainhash.Hash) (string, error)
GetTxBlockHash returns block hash of fake block for fake tx
type SidechainClientOcean ¶
type SidechainClientOcean struct {
// contains filtered or unexported fields
}
SidechainClientOcean structure Ocean implementation for the sidechain client interface
func NewSidechainClientOcean ¶
func NewSidechainClientOcean(rpc *rpcclient.Client) *SidechainClientOcean
NewSidechainClientOcean returns new instance of SideChainClient for Ocean
func (*SidechainClientOcean) Close ¶
func (o *SidechainClientOcean) Close()
Close function shuts down the rpc connection to Ocean
func (*SidechainClientOcean) GetBestBlockHash ¶
func (o *SidechainClientOcean) GetBestBlockHash() (*chainhash.Hash, error)
GetBestBlockHash Ocean implementation using underlying rpc client
func (*SidechainClientOcean) GetBlockCount ¶
func (o *SidechainClientOcean) GetBlockCount() (int64, error)
GetBlockCount Ocean implementation using underlying rpc client
func (*SidechainClientOcean) GetBlockHash ¶
func (o *SidechainClientOcean) GetBlockHash(height int64) (*chainhash.Hash, error)
GetBlockHash Ocean implementation using underlying rpc client
func (*SidechainClientOcean) GetBlockHeight ¶
func (o *SidechainClientOcean) GetBlockHeight(hash *chainhash.Hash) (int32, error)
GetBlockHeight Ocean implementation using underlying rpc client
func (*SidechainClientOcean) GetTxBlockHash ¶
func (o *SidechainClientOcean) GetTxBlockHash(hash *chainhash.Hash) (string, error)
GetTxBlockHash Ocean implementation using underlying rpc client