Documentation ¶
Index ¶
- Constants
- type BlockMetaAccessor
- type BlockScanner
- type Client
- func (c *Client) BroadcastTx(stx stypes.TxOutItem, hexTx []byte) error
- func (c *Client) GetAccount(pkey common.PubKey) (common.Account, error)
- func (c *Client) GetAccountByAddress(address string) (common.Account, error)
- func (c *Client) GetAddress(poolPubKey common.PubKey) string
- func (c *Client) GetChain() common.Chain
- func (c *Client) GetConfig() config.ChainConfiguration
- func (c *Client) GetGasFee(count uint64) common.Gas
- func (c *Client) GetGasPrice() (*big.Int, error)
- func (c *Client) GetHeight() (int64, error)
- func (c *Client) GetNonce(addr string) (uint64, error)
- func (c *Client) InitChainID()
- func (c *Client) SignTx(tx stypes.TxOutItem, height int64) ([]byte, error)
- func (c *Client) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock)
- func (c *Client) Stop()
- type KeySignWrapper
- type LevelDBBlockMetaAccessor
- func (t *LevelDBBlockMetaAccessor) GetBlockMeta(height int64) (*types.BlockMeta, error)
- func (t *LevelDBBlockMetaAccessor) GetBlockMetas() ([]*types.BlockMeta, error)
- func (t *LevelDBBlockMetaAccessor) PruneBlockMeta(height int64) error
- func (t *LevelDBBlockMetaAccessor) SaveBlockMeta(height int64, blockMeta *types.BlockMeta) error
Constants ¶
const ( DefaultObserverLevelDBFolder = `observer_data` BlockCacheSize = 200 )
const (
PrefixBlockMeta = `blockmeta-`
)
PrefixTxStorage declares prefix to use in leveldb to avoid conflicts
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockMetaAccessor ¶
type BlockMetaAccessor interface { GetBlockMetas() ([]*types.BlockMeta, error) GetBlockMeta(height int64) (*types.BlockMeta, error) SaveBlockMeta(height int64, block *types.BlockMeta) error PruneBlockMeta(height int64) error }
BlockMetaAccessor define methods need to access block meta storage
type BlockScanner ¶
type BlockScanner struct {
// contains filtered or unexported fields
}
BlockScanner is to scan the blocks
func NewBlockScanner ¶
func NewBlockScanner(cfg config.BlockScannerConfiguration, storage blockscanner.ScannerStorage, chainID types.ChainID, client *ethclient.Client, bridge *thorclient.ThorchainBridge, m *metrics.Metrics) (*BlockScanner, error)
NewBlockScanner create a new instance of BlockScan
func (*BlockScanner) GetGasPrice ¶
func (e *BlockScanner) GetGasPrice() *big.Int
GetGasPrice returns current gas price
func (*BlockScanner) GetHeight ¶
func (e *BlockScanner) GetHeight() (int64, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a structure to sign and broadcast tx to Ethereum chain used by signer mostly
func NewClient ¶
func NewClient(thorKeys *thorclient.Keys, cfg config.ChainConfiguration, server *tssp.TssServer, thorchainBridge *thorclient.ThorchainBridge, m *metrics.Metrics, keySignPartyMgr *thorclient.KeySignPartyMgr) (*Client, error)
NewClient create new instance of Ethereum client
func (*Client) BroadcastTx ¶
BroadcastTx decodes tx using rlp and broadcasts too Ethereum chain
func (*Client) GetAccount ¶
GetAccount gets account by address in eth client
func (*Client) GetAccountByAddress ¶
func (*Client) GetAddress ¶
GetAddress return current signer address, it will be bech32 encoded address
func (*Client) GetConfig ¶
func (c *Client) GetConfig() config.ChainConfiguration
func (*Client) InitChainID ¶
func (c *Client) InitChainID()
IsTestNet determinate whether we are running on test net by checking the status
type KeySignWrapper ¶
type KeySignWrapper struct {
// contains filtered or unexported fields
}
KeySignWrapper is a wrap of private key and also tss instance
func (*KeySignWrapper) GetPrivKey ¶
func (w *KeySignWrapper) GetPrivKey() *ecdsa.PrivateKey
func (*KeySignWrapper) GetPubKey ¶
func (w *KeySignWrapper) GetPubKey() common.PubKey
type LevelDBBlockMetaAccessor ¶
type LevelDBBlockMetaAccessor struct {
// contains filtered or unexported fields
}
LevelDBBlockMetaAccessor struct
func NewLevelDBBlockMetaAccessor ¶
func NewLevelDBBlockMetaAccessor(db *leveldb.DB) (*LevelDBBlockMetaAccessor, error)
NewLevelDBBlockMetaAccessor creates a new level db backed BlockMeta accessor
func (*LevelDBBlockMetaAccessor) GetBlockMeta ¶
func (t *LevelDBBlockMetaAccessor) GetBlockMeta(height int64) (*types.BlockMeta, error)
GetBlockMeta at given block height , when the requested block meta doesn't exist , it will return nil , thus caller need to double check it
func (*LevelDBBlockMetaAccessor) GetBlockMetas ¶
func (t *LevelDBBlockMetaAccessor) GetBlockMetas() ([]*types.BlockMeta, error)
GetBlockMetas returns all the block metas in storage The chain client will Prune block metas every time it finished scan a block , so at maximum it will keep BlockCacheSize blocks thus it should not grow out of control
func (*LevelDBBlockMetaAccessor) PruneBlockMeta ¶
func (t *LevelDBBlockMetaAccessor) PruneBlockMeta(height int64) error
PruneBlockMeta remove all block meta that is older than the given block height with exception, if there are unspent transaction output in it , then the block meta will not be removed
func (*LevelDBBlockMetaAccessor) SaveBlockMeta ¶
func (t *LevelDBBlockMetaAccessor) SaveBlockMeta(height int64, blockMeta *types.BlockMeta) error
SaveBlockMeta persistent the given BlockMeta into storage