code: func (m *wsNotificationManager) notifyForTxIns(ops map[wire.OutPoint]map[chan struct{}]*wsClient,
  	tx *btcutil.Tx, block *btcutil.Block) {
  
  	// Nothing to do if nobody is watching outpoints.
  	if len(ops) == 0 {
  		return
  	}
  
  	txHex := ""
  	wscNotified := make(map[chan struct{}]struct{})
  	for _, txIn := range tx.MsgTx().TxIn {
  		prevOut := &txIn.PreviousOutPoint
  		if cmap, ok := ops[*prevOut]; ok {
  			if txHex == "" {
  				txHex = txHexString(tx.MsgTx())
  			}
  			marshalledJSON, err := newRedeemingTxNotification(txHex, tx.Index(), block)
  			if err != nil {
  				rpcsLog.Warnf("Failed to marshal redeemingtx notification: %v", err)
  				continue
  			}
  			for wscQuit, wsc := range cmap {
  				if block != nil {
  					m.removeSpentRequest(ops, wsc, prevOut)
  				}
  
  				if _, ok := wscNotified[wscQuit]; !ok {
  					wscNotified[wscQuit] = struct{}{}
  					wsc.QueueNotification(marshalledJSON)
  				}
  			}
  		}
  	}
  }
docs: // notifyForTxIns examines the inputs of the passed transaction and sends
  // interested websocket clients a redeemingtx notification if any inputs
  // spend a watched output.  If block is non-nil, any matching spent
  // requests are removed.