code: func (m *wsNotificationManager) notifyForNewTx(clients map[chan struct{}]*wsClient, tx *btcutil.Tx) {
  	txHashStr := tx.Hash().String()
  	mtx := tx.MsgTx()
  
  	var amount int64
  	for _, txOut := range mtx.TxOut {
  		amount += txOut.Value
  	}
  
  	ntfn := btcjson.NewTxAcceptedNtfn(txHashStr, btcutil.Amount(amount).ToBTC())
  	marshalledJSON, err := btcjson.MarshalCmd(nil, ntfn)
  	if err != nil {
  		rpcsLog.Errorf("Failed to marshal tx notification: %s", err.Error())
  		return
  	}
  
  	var verboseNtfn *btcjson.TxAcceptedVerboseNtfn
  	var marshalledJSONVerbose []byte
  	for _, wsc := range clients {
  		if wsc.verboseTxUpdates {
  			if marshalledJSONVerbose != nil {
  				wsc.QueueNotification(marshalledJSONVerbose)
  				continue
  			}
  
  			net := m.server.cfg.ChainParams
  			rawTx, err := createTxRawResult(net, mtx, txHashStr, nil,
  				"", 0, 0)
  			if err != nil {
  				return
  			}
  
  			verboseNtfn = btcjson.NewTxAcceptedVerboseNtfn(*rawTx)
  			marshalledJSONVerbose, err = btcjson.MarshalCmd(nil,
  				verboseNtfn)
  			if err != nil {
  				rpcsLog.Errorf("Failed to marshal verbose tx "+
  					"notification: %s", err.Error())
  				return
  			}
  			wsc.QueueNotification(marshalledJSONVerbose)
  		} else {
  			wsc.QueueNotification(marshalledJSON)
  		}
  	}
  }
docs: // notifyForNewTx notifies websocket clients that have registered for updates
  // when a new transaction is added to the memory pool.