def check_sig(script_sig, pubkey, script_code, sig_version)
      return false if script_sig.empty?
      script_sig = script_sig.htb
      hash_type = script_sig[-1].unpack('C').first
      sig = script_sig[0..-2]
      sighash = tx.sighash_for_input(input_index, script_code, hash_type: hash_type,
                                     amount: amount, sig_version: sig_version)
      key_type = pubkey.start_with?('02') || pubkey.start_with?('03') ? Key::TYPES[:compressed] : Key::TYPES[:uncompressed]
      key = Key.new(pubkey: pubkey, key_type: key_type)
      key.verify(sig, sighash)
    end
def check_sig(script_sig, pubkey, script_code, sig_version)
      return false if script_sig.empty?
      script_sig = script_sig.htb
      hash_type = script_sig[-1].unpack('C').first
      sig = script_sig[0..-2]
      sighash = tx.sighash_for_input(input_index, script_code, hash_type: hash_type,
                                     amount: amount, sig_version: sig_version)
      key_type = pubkey.start_with?('02') || pubkey.start_with?('03') ? Key::TYPES[:compressed] : Key::TYPES[:uncompressed]
      key = Key.new(pubkey: pubkey, key_type: key_type)
      key.verify(sig, sighash)
    end
check signature
 @param [String] script_sig
 @param [String] pubkey
 @param [Bitcoin::Script] script_code
 @param [Integer] sig_version