code: func CountSigOps(tx *btcutil.Tx) int {
  	msgTx := tx.MsgTx()
  
  	// Accumulate the number of signature operations in all transaction
  	// inputs.
  	totalSigOps := 0
  	for _, txIn := range msgTx.TxIn {
  		numSigOps := txscript.GetSigOpCount(txIn.SignatureScript)
  		totalSigOps += numSigOps
  	}
  
  	// Accumulate the number of signature operations in all transaction
  	// outputs.
  	for _, txOut := range msgTx.TxOut {
  		numSigOps := txscript.GetSigOpCount(txOut.PkScript)
  		totalSigOps += numSigOps
  	}
  
  	return totalSigOps
  }
docs: // CountSigOps returns the number of signature operations for all transaction
  // input and output scripts in the provided transaction.  This uses the
  // quicker, but imprecise, signature operation counting mechanism from
  // txscript.