From 737e69594ba9ef024f935b82ecbef9cda0b8fb0d Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 17 Jan 2014 13:11:49 -0600 Subject: [PATCH] Don't spend time on txout ntfns when no listeners. --- rpcwebsocket.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpcwebsocket.go b/rpcwebsocket.go index ef536f14..0bf3550b 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -804,6 +804,11 @@ func (s *rpcServer) newBlockNotifyCheckTxIn(tx *btcutil.Tx) { // necessary notifications for wallets. If a non-nil block is passed, // additional block information is passed with the notifications. func (s *rpcServer) NotifyForTxOuts(tx *btcutil.Tx, block *btcutil.Block) { + // Nothing to do if nobody is listening for transaction notifications. + if len(s.ws.txNotifications) == 0 { + return + } + for i, txout := range tx.MsgTx().TxOut { _, addrs, _, err := btcscript.ExtractPkScriptAddrs( txout.PkScript, s.server.btcnet)