From f22164b261b7dde58f6504f4244fd086c02c7477 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 2 Dec 2013 10:35:25 -0500 Subject: [PATCH] Search each txout for payment to a wallet address. This switches a break to a continue if a txout does not include a pay-to-pubkey-hash script type. btcwallet only supports pay-to-pubkey-hash at the moment, and this fixes an issue where a tx may have an different type of output, as well as pay-to-pubkey-hash, which may be ignored by the wallet notification code. Found by dhill. --- rpcserver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 3587eec3..a2c804ef 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1639,10 +1639,10 @@ func (s *rpcServer) newBlockNotifyCheckTxOut(block *btcutil.Block, tx *btcutil.Tx) { for i, txout := range tx.MsgTx().TxOut { - _, txaddrhash, err := btcscript.ScriptToAddrHash(txout.PkScript) - if err != nil { - rpcsLog.Debug("Error getting payment address from tx; dropping any Tx notifications.") - break + stype, txaddrhash, err := btcscript.ScriptToAddrHash(txout.PkScript) + if stype != btcscript.ScriptAddr || err != nil { + // Only support pay-to-pubkey-hash right now. + continue } if idlist, ok := s.ws.txNotifications[string(txaddrhash)]; ok { for e := idlist.Front(); e != nil; e = e.Next() {