lib/bitcoin/script.rb
# This method applies to script_sig that is an input for p2sh output.
# Bitcoind has somewhat special way to return count for invalid input scripts:
# it returns 0 when the opcode can't be parsed or when it's over OP_16.
# Also, if the OP_{N} is used anywhere it's treated as 0-length data.
# See CScript::GetSigOpCount(const CScript& scriptSig) in bitcoind.
This method applies to script_sig that is an input for p2sh output.
Bitcoind has somewhat special way to return count for invalid input scripts:
it returns 0 when the opcode can't be parsed or when it's over OP_16.
Also, if the OP_{N} is used anywhere it's treated as 0-length data.
This method applies to script_sig that is an input for p2sh output . Bitcoind has somewhat special way to return count for invalid input scripts : it returns 0 when the opcode can ' t be parsed or when it ' s over OP_16 . Also if the OP_ { N } is used anywhere it ' s treated as 0 - length data .
def sigops_count_for_p2sh
    return 0 if @chunks.size == 0
    data = nil
    @chunks.each do |chunk|
      case chunk
      when Bitcoin::Integer
        data = ""
        return 0 if chunk > OP_16
      when String
        data = chunk
      end
    end
    return 0 if data == ""
    ::Bitcoin::Script.new(data).sigops_count_accurate(true)
  end
def sigops_count_for_p2sh return 0 if @chunks . size == 0 data = nil @chunks . each do | chunk | case chunk when Bitcoin :: Integer data = "" return 0 if chunk > OP_16 when String data = chunk end end return 0 if data == "" :: Bitcoin :: Script . new ( data ) . sigops_count_accurate ( true ) end
This method applies to script_sig that is an input for p2sh output.
This method applies to script_sig that is an input for p2sh output .
# This is a pay-to-script-hash scriptPubKey; # get the last item that the scriptSig # pushes onto the stack: