本文整理匯總了Golang中github.com/decred/dcrrpcclient.Client.NotifyBlocks方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.NotifyBlocks方法的具體用法?Golang Client.NotifyBlocks怎麽用?Golang Client.NotifyBlocks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/decred/dcrrpcclient.Client
的用法示例。
在下文中一共展示了Client.NotifyBlocks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: connectRPCClient
// connectRPCClient attempts to establish an RPC connection to the created
// dcrd process belonging to this Harness instance. If the initial connection
// attempt fails, this function will retry h.maxConnRetries times, backing off
// the time between subsequent attempts. If after h.maxConnRetries attempts,
// we're not able to establish a connection, this function returns with an error.
func (h *Harness) connectRPCClient() error {
var client *rpc.Client
var err error
rpcConf := h.node.config.rpcConnConfig()
for i := 0; i < h.maxConnRetries; i++ {
if client, err = rpc.New(&rpcConf, h.handlers); err != nil {
time.Sleep(time.Duration(math.Log(float64(i+3))) * 50 * time.Millisecond)
continue
}
break
}
if client == nil {
return fmt.Errorf("connection timed out: %v", err)
}
err = client.NotifyBlocks()
if err != nil {
return err
}
h.Node = client
return nil
}