Documentation ¶
Index ¶
- Constants
- func DO_getCC(first, last int64, respData []byte) (*ccrpc.CCrpcEpoch, error)
- type RpcClientImp
- func (client *RpcClientImp) FetchCC(first, last int64) *ccrpc.CCrpcEpoch
- func (client *RpcClientImp) GetBlockByHeight(height int64, retry bool) *watcher.BCHBlock
- func (client *RpcClientImp) GetBlockHash(height int64) (string, error)
- func (client *RpcClientImp) GetBlockInfo(hash string) (*watcher.BlockInfo, error)
- func (client *RpcClientImp) GetCCEpochs(start, end uint64) []*crosschain.CCEpoch
- func (client *RpcClientImp) GetEpochs(start, end uint64) []*staking.Epoch
- func (client *RpcClientImp) GetMainnetHeight() (height int64)
- func (client *RpcClientImp) GetTxInfo(hash string, blockhash string) (*watcher.TxInfo, error)
- func (client *RpcClientImp) IsConnected() bool
- func (client *RpcClientImp) NetworkSmartHeight() (height int64)
- type Watcher
- func (watcher *Watcher) CheckMainnet()
- func (watcher *Watcher) ClearOldData()
- func (watcher *Watcher) GetCurrEpoch() *stake.Epoch
- func (watcher *Watcher) GetCurrMainnetBlockTimestamp() int64
- func (watcher *Watcher) GetEpochList() []*stake.Epoch
- func (watcher *Watcher) NetworkSmartHeight() int64
- func (watcher *Watcher) SetNumBlocksInEpoch(n int64)
- func (watcher *Watcher) SetNumBlocksToClearMemory(n int)
- func (watcher *Watcher) SetWaitingBlockDelayTime(n int)
- func (watcher *Watcher) WatcherMain(catchupChan chan bool)
Constants ¶
View Source
const ( ReqStrBlockCount = `{"jsonrpc": "1.0", "id":"zeniqsmart", "method": "getblockcount", "params": [] }` ReqStrBlockHash = `{"jsonrpc": "1.0", "id":"zeniqsmart", "method": "getblockhash", "params": [%d] }` //verbose = 2, show all txs rawdata ReqStrBlock = `{"jsonrpc": "1.0", "id":"zeniqsmart", "method": "getblock", "params": ["%s",2] }` ReqStrTx = `{"jsonrpc": "1.0", "id":"zeniqsmart", "method": "getrawtransaction", "params": ["%s", true, "%s"] }` ReqStrCC = `{"jsonrpc": "1.0", "id":"zeniqsmart", "method": "crosschain", "params": ["%d", "%d"] }` ReqStrEpochs = `{"jsonrpc": "2.0", "method": "sbch_getEpochs", "params": ["%s","%s"], "id":1}` ReqStrCCEpochs = `{"jsonrpc": "2.0", "method": "sbch_getCCEpochs", "params": ["%s","%s"], "id":1}` ReqSmartHeight = `{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id":1}` )
View Source
const ( NumBlocksToClearMemory = 1000 WaitingBlockDelayTime = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RpcClientImp ¶
type RpcClientImp struct {
// contains filtered or unexported fields
}
func NewRpcClient ¶
func NewRpcClient(url, user, password, contentType string, logger log.Logger) *RpcClientImp
func (*RpcClientImp) FetchCC ¶
func (client *RpcClientImp) FetchCC(first, last int64) *ccrpc.CCrpcEpoch
func (*RpcClientImp) GetBlockByHeight ¶
func (client *RpcClientImp) GetBlockByHeight(height int64, retry bool) *watcher.BCHBlock
func (*RpcClientImp) GetBlockHash ¶
func (client *RpcClientImp) GetBlockHash(height int64) (string, error)
**for tool
func (*RpcClientImp) GetBlockInfo ¶
func (client *RpcClientImp) GetBlockInfo(hash string) (*watcher.BlockInfo, error)
func (*RpcClientImp) GetCCEpochs ¶
func (client *RpcClientImp) GetCCEpochs(start, end uint64) []*crosschain.CCEpoch
func (*RpcClientImp) GetEpochs ¶
func (client *RpcClientImp) GetEpochs(start, end uint64) []*staking.Epoch
func (*RpcClientImp) GetMainnetHeight ¶
func (client *RpcClientImp) GetMainnetHeight() (height int64)
func (*RpcClientImp) IsConnected ¶
func (client *RpcClientImp) IsConnected() bool
func (*RpcClientImp) NetworkSmartHeight ¶
func (client *RpcClientImp) NetworkSmartHeight() (height int64)
type Watcher ¶
type Watcher struct { EpochChan chan *stake.Epoch CCEpochChan chan *crosschain.CCEpoch // contains filtered or unexported fields }
A watcher watches the new blocks generated on bitcoin cash's mainnet, and outputs epoch information through a channel
func NewWatcher ¶
func (*Watcher) CheckMainnet ¶
func (watcher *Watcher) CheckMainnet()
func (*Watcher) ClearOldData ¶
func (watcher *Watcher) ClearOldData()
func (*Watcher) GetCurrEpoch ¶
func (*Watcher) GetCurrMainnetBlockTimestamp ¶
func (*Watcher) GetEpochList ¶
func (*Watcher) NetworkSmartHeight ¶
func (*Watcher) SetNumBlocksInEpoch ¶
func (*Watcher) SetNumBlocksToClearMemory ¶
func (*Watcher) SetWaitingBlockDelayTime ¶
func (*Watcher) WatcherMain ¶
The main function to do a watcher's job. It must be run as a goroutine
Click to show internal directories.
Click to hide internal directories.