本文整理匯總了Golang中github.com/decred/dcrwallet/chain.RPCClient.NotificationsVoting方法的典型用法代碼示例。如果您正苦於以下問題:Golang RPCClient.NotificationsVoting方法的具體用法?Golang RPCClient.NotificationsVoting怎麽用?Golang RPCClient.NotificationsVoting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/decred/dcrwallet/chain.RPCClient
的用法示例。
在下文中一共展示了RPCClient.NotificationsVoting方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleChainVotingNotifications
func (w *Wallet) handleChainVotingNotifications(chainClient *chain.RPCClient) {
for n := range chainClient.NotificationsVoting() {
var err error
strErrType := ""
switch n := n.(type) {
case chain.WinningTickets:
err = walletdb.Update(w.db, func(dbtx walletdb.ReadWriteTx) error {
return w.handleWinningTickets(dbtx, n.BlockHash, n.BlockHeight, n.Tickets)
})
strErrType = "WinningTickets"
case chain.MissedTickets:
err = walletdb.Update(w.db, func(dbtx walletdb.ReadWriteTx) error {
return w.handleMissedTickets(dbtx, n.BlockHash, n.BlockHeight, n.Tickets)
})
strErrType = "MissedTickets"
default:
err = fmt.Errorf("voting handler received unknown ntfn type")
}
if err != nil {
log.Errorf("Cannot handle chain server voting "+
"notification %v: %v", strErrType, err)
}
}
w.wg.Done()
}