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.
This commit is contained in:
parent
aea23ddff3
commit
f22164b261
1 changed files with 4 additions and 4 deletions
|
@ -1639,10 +1639,10 @@ func (s *rpcServer) newBlockNotifyCheckTxOut(block *btcutil.Block,
|
||||||
tx *btcutil.Tx) {
|
tx *btcutil.Tx) {
|
||||||
|
|
||||||
for i, txout := range tx.MsgTx().TxOut {
|
for i, txout := range tx.MsgTx().TxOut {
|
||||||
_, txaddrhash, err := btcscript.ScriptToAddrHash(txout.PkScript)
|
stype, txaddrhash, err := btcscript.ScriptToAddrHash(txout.PkScript)
|
||||||
if err != nil {
|
if stype != btcscript.ScriptAddr || err != nil {
|
||||||
rpcsLog.Debug("Error getting payment address from tx; dropping any Tx notifications.")
|
// Only support pay-to-pubkey-hash right now.
|
||||||
break
|
continue
|
||||||
}
|
}
|
||||||
if idlist, ok := s.ws.txNotifications[string(txaddrhash)]; ok {
|
if idlist, ok := s.ws.txNotifications[string(txaddrhash)]; ok {
|
||||||
for e := idlist.Front(); e != nil; e = e.Next() {
|
for e := idlist.Front(); e != nil; e = e.Next() {
|
||||||
|
|
Loading…
Reference in a new issue