clients

package
v0.0.0-...-b93563f Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 4 Imported by: 0

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

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) GetBlock

func (f *SidechainClientFake) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)

GetBlockHash not implemented

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) GetBlock

func (o *SidechainClientOcean) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)

GetBlock 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

Jump to

Keyboard shortcuts

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