• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

spesmilo / electrum
60%
master: 61%

Build:
Build:
LAST BUILD BRANCH: refactor_htlc_handling
DEFAULT BRANCH: master
Repo Added 10 Nov 2017 08:46AM UTC
Files 88
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH 202505_transaction_verify_sig_2
branch: 202505_transaction_verify_sig_2
CHANGE BRANCH
x
Reset
  • 202505_transaction_verify_sig_2
  • 140325-force-close-exception
  • 202006_fee_spike_buffer
  • 202006_jsonschema_rm
  • 202006_release_notes
  • 202006_review_channel_open_flow
  • 20230321_ply
  • 202304_util_age
  • 202401_wallet_fullrbf
  • 202501_bump_min_python
  • 202501_funding_pubkey_deriv
  • 202501_lnpeer_tramp_test1
  • 202502_keepkey
  • 202503_asyncio_gc
  • 202503_avoid_reuse
  • 202503_bump_freeze_packages
  • 202503_ci_py313
  • 202503_config_cv_setter
  • 202503_configvar_plugins
  • 202503_is_frozen_futuretx
  • 202503_plugins_init_exception
  • 202503_regtest_configvars
  • 202503_rm_ledger_hw1
  • 202504_cirrus_test
  • 202504_harden_memory_linux
  • 202504_locale
  • 202505_adb_get_tx_height
  • 202505_adb_get_tx_height_test
  • 202505_adb_transaction_lock
  • 202505_ban_unicode
  • 202505_build1
  • 202505_chan_save_error
  • 202505_ci_bump_ex
  • 202505_network_oneserver_text
  • 202505_pad_protocol_3
  • 202505_refactor_chains
  • 202505_refactor_chains2
  • 202505_refactor_lnchannel_ctx_updates
  • 202506_base64_trailing_garbage
  • 202506_ci_bump_ex
  • 202506_daemon_walletkey
  • 202506_gui_swapserver_pubkey
  • 202506_iface_headers3
  • 202506_iface_headers_backwards
  • 202506_lnwatcher_to_wait_until_fees_go_down
  • 202506_qml_lnurl_btn_disabled
  • 202506_qt_mac_camera_permission
  • 202506_qt_qrtextedit_rm_dupe
  • 202506_qtmultimedia
  • 202506_regtest_swapserver
  • 202506_txbatcher_cleanup
  • 202507_android_chain_hack
  • 202507_android_rm_blacklist
  • 202507_interface_fast_forward
  • 202507_issue10021
  • 202507_jsonpatch_monkeypatch_exc
  • 202507_keystore_cleanup
  • 202507_logging_only_once
  • 202507_qml_crash_reporter_flickable
  • 202507_qt_confirm_txdialog_fee
  • 202507_qt_crash_felix_2
  • 202507_sorted_nets_list
  • 202507_syntax_check_i18n_format_strings
  • 202507_walletdb_add_configvar_partial_writes
  • 202507_walletdb_add_configvar_partial_writes_4
  • 202508_change_gap_limit_for_change
  • 202508_cmd_format_satoshis
  • 202508_commands_onchain_history
  • 202508_debug_mem
  • 202508_fix_old_keystore_check_password
  • 202508_iface_cache_broadcast_tx
  • 202508_kswizard_multisig
  • 202508_lnpeer_rate_limits
  • 202508_lower_minrelayfee
  • 202508_max_logfile_size
  • 202508_qml_wallet_ks_password
  • 202508_release462
  • 202508_swap_sanity_check_costs
  • 202508_swaps_check_cltv_safety
  • 202508_swaps_dm_replies
  • 202508_swaps_more_cleanup
  • 202508_swaps_parsing
  • 202508_test_keystore_wizard
  • 202508_tests_wizard
  • 202508_typehint_callables
  • 202508_wallet_delete_address
  • 202508_wallet_verified_event
  • 202509_adb_spv
  • 202509_bash_subshell_set_e
  • 202509_ci_appimage
  • 202509_consoletaint
  • 202509_getwallet_win_path
  • 202509_lnreserve_usechangeoff
  • 202509_plugin_offline_cmd
  • 202509_storage_oschmod
  • 202509_sweep_none
  • 202509_tests_clear_callbacks
  • 202509_tests_for_old_hex_seed
  • 202509_tox
  • 202509_type_hints_qml_txf
  • 202509_wallet_rbf_candidates
  • 22nd_century_certs
  • 2fa_segwit
  • 3.0.2
  • 3.0.3
  • 3.0.4
  • 3.0.5
  • 3.0.6
  • 3.0.x
  • 3.1
  • 3.1.0
  • 3.1.1
  • 3.1.2
  • 3.1.3
  • 3.2.0
  • 3.2.1
  • 3.2.2
  • 3.2.3
  • 3.2.4
  • 3.2.x
  • 3.3.0
  • 3.3.1
  • 3.3.2
  • 3.3.3
  • 3.3.3.1
  • 3.3.4
  • 3.3.5
  • 3.3.6
  • 3.3.7
  • 3.3.8
  • 4.0.0b0
  • 4.0.0b1
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.0.5
  • 4.0.6
  • 4.0.7
  • 4.0.8
  • 4.0.9
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.x
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.3.4
  • 4.3.x
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.4.4
  • 4.4.5
  • 4.4.6
  • 4.4.x
  • 4.5.0
  • 4.5.0b0
  • 4.5.0b1
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.5-fdroid
  • 4.5.6
  • 4.5.7
  • 4.5.8
  • 4.5.x
  • 4.6.0
  • 4.6.0b1
  • 4.6.1
  • 4.6.2
  • EagleTM-serversjson-1
  • accounting_addresses
  • add_ecc_and_aionostr_submodules
  • add_felix_pgp_key
  • add_logging_whitelist
  • add_logging_whitelist_simpler
  • add_remove_plugins
  • add_revealer_infos
  • add_swapserver_summary_cli
  • add_transaction
  • addresses_dict
  • addresses_ref
  • aiorpcx
  • aiorpcx-async-headers-rebased
  • aiorpcx-connection-lost
  • aiorpcx-fx
  • allow_lnaddress_contacts
  • allow_more_genesis_in_crash_reporter
  • anchor_commitments_2022
  • anchor_output_sweeping_lower_fee
  • android-qml
  • android-qml-repro
  • android15_edge_to_edge_compatibility
  • android_16kb_page_alignment
  • android_permissions_support
  • android_qml_qrscan_signals
  • android_qr_scanner_lifecycle
  • append_to_encrypted
  • appimage-debian-base
  • asyncio
  • attr_invoices
  • autoremove_invoices
  • basic_mpp
  • basic_mpp_send
  • batch_payments_manager
  • batching_candidates
  • beta-test
  • buildozer_qml
  • bump_aiorpcx
  • bump_fee_txbatcher
  • capacity_warning_zero_amount
  • change_android_qr_lib
  • change_plugin_keyfile_path
  • changes_to_release_notes
  • channel_announcements
  • channel_backup_version
  • channel_forceclosing_warning
  • channel_states
  • check_hold_invoice_show_htlc_cltv
  • check_wallet_file_writable
  • ci-qml-beta
  • cleanup_lnutil
  • cli_fix_wallet_path
  • cli_get_preimage
  • closing_states
  • coin_chooser_no_outputs
  • command_fetch_swap_providers
  • common_taskthread
  • concurrent_lookup_of_payment_identifier
  • config_current_wallet
  • confirm_tx_dialog
  • conflicting_channels
  • daemon_error_forwarding
  • debug_ln_payment_failure
  • dedicated_data_type_for_swap_offers
  • dependabot/pip/contrib/deterministic-build/aiohttp-3.7.4
  • dependabot/pip/contrib/deterministic-build/cryptography-3.2
  • dependabot/pip/contrib/deterministic-build/cryptography-3.3.2
  • dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
  • dependabot/pip/contrib/deterministic-build/urllib3-1.26.4
  • dependabot/pip/contrib/deterministic-build/urllib3-1.26.5
  • deprecation_warning_coroutinefunction
  • detect_address_reuse
  • deterministic_node_id
  • disable_disabling_i_agree_ToU
  • disable_gossip_compression
  • dm_replies_no_defaultdict
  • docker_win
  • dont_delete_config_on_syntax_error
  • draft
  • electrum_ecc_submodule
  • enable_anchors_default
  • enforce_requested_min_final_cltv_delta
  • fail_normal_swap
  • failed_trampoline_routes
  • fee_descriptor_names
  • fee_policies
  • fee_policy_static_rate_fallback
  • fee_ui
  • file_layout_change_for_master
  • fix_10097
  • fix_10117
  • fix_10144
  • fix_4111
  • fix_8100
  • fix_8213
  • fix_8547
  • fix_8712
  • fix_9440
  • fix_9536
  • fix_9700
  • fix_9761
  • fix_9829
  • fix_ToU_workaround
  • fix_block_exception_dialog
  • fix_bolt11_pi_exceptions
  • fix_channel_freezing
  • fix_ci
  • fix_ci_aiohttp
  • fix_ci_pip
  • fix_command_gettransaction
  • fix_confirm_tx_dialog_timer_exc
  • fix_enable_gossip
  • fix_exception_suggest_swap_to_send
  • fix_fee_disagreement_ln
  • fix_fee_slider_qml_channel_open
  • fix_fiat_history_export
  • fix_flaky_swapserver_list_qml
  • fix_history_export
  • fix_is_initialized_race_swap_manager
  • fix_issue_10053
  • fix_issue_10057
  • fix_issue_10065
  • fix_lightning_can_receive_offline_peer
  • fix_lnwatcher_9789
  • fix_lnwatcher_callback
  • fix_make_barcode_scanner_log_vars
  • fix_missing_menu_icons_macos
  • fix_new_channel_exception
  • fix_node_ann_exception
  • fix_node_ann_features
  • fix_osx_extract_sigs
  • fix_padding_qml_exc_dialog
  • fix_password_command
  • fix_plugin_aiohttp_client_session
  • fix_plugins_dialog_bad_state
  • fix_qml_label_setting
  • fix_qml_wizard_exception
  • fix_qr_input_from_file
  • fix_rbf_csv
  • fix_receive_unknown_htlc_failed
  • fix_revealer_backup
  • fix_rswap_exception
  • fix_setDesktopFilename_warning
  • fix_show_transaction_user_cancelled
  • fix_suggest_peer
  • fix_swap_exception
  • fix_swap_exception_send_change_to_lightning
  • fix_swap_pay_invoice
  • fix_swap_update_relays
  • fix_swapserver_budget
  • fix_swapserver_trampoline
  • fix_terms_wizard_windows
  • fix_too_large_onion_payload
  • fix_tui_crash
  • fix_tx_dialog_exception
  • fix_update_amount
  • fix_wine_unsign
  • follow_system_theme
  • follow_up_8619
  • followup_tos_qt
  • format_cli_help
  • fs_permissions_check
  • fully_spend_utxo
  • future_tx_fee
  • gossip_forwarding
  • gossip_info
  • gossip_timestamp_filter
  • group_transactions
  • handle_qe_swap_task_exceptions
  • handle_shutil_copyfile_exception
  • hi_res_old_icons
  • history_cleanup
  • history_recycle_view
  • historybuttons
  • hold_invoice_cli
  • hold_invoice_cli_hash
  • hook_transaction_dialog_address_menu
  • htlc_slots_left
  • hw_password_encryption
  • hww_offline_err_fix
  • improve_cmdline_help
  • improve_not_enough_funds_mentioning_frozen
  • improve_qml_passphrase_wizard
  • improve_relay_string_input
  • improve_reverse_swap_mining_fee
  • improve_swaps_send_dm
  • improve_windows_installer_safety
  • improved_trampoline_error
  • jit
  • jit-accept-non-recoverable
  • jit-block-preimage
  • jit-gui-improvements
  • jit-improve-qml
  • jit-invoice-creation
  • jit-regtest
  • jit-update-funded-state
  • jit-update-unfunded-state
  • jsondb_pointers
  • jsondict
  • jsonpatch
  • jsonpatch-ln
  • jsonpatch_encapsulate
  • jsonpatch_new
  • jsonrpc_nodeps
  • just_in_time_channels
  • just_in_time_channels_refactored
  • keystore_wizard
  • keystorewizard_scriptandderivation
  • kivy_fix_6201
  • kivy_new
  • libera-verify-245857204
  • lightning
  • lightning_pass_invoice_not_bolt11
  • lightning_pay_assertion_error
  • lightning_requests
  • listconfig
  • ln_chan_reest_20190801
  • ln_disable_fallback_fee
  • ln_fee_updates
  • ln_gossip
  • ln_jsonrpc
  • ln_kivy
  • ln_router
  • ln_rpc
  • ln_test
  • ln_watcher
  • lnmsg
  • lnsweep
  • lnsweep_201905
  • lnsweep_dicts
  • lnsweep_txin
  • lnurl_withdraw
  • lnwatcher_fix_9987
  • lnwatcher_not_async
  • lnwatcher_trigger_callbacks
  • lnworker_channelopen_min_amount
  • lnworker_imports
  • load_wallet_refactor
  • local_tx
  • locale_depreciation
  • macos-deterministic
  • make_segwit_default
  • master
  • match_htlc_witness_templates
  • matplotlib_warning
  • max-no-local-tx
  • max_cltv_lnpay
  • maybe_complete_wallet_path
  • mempoolfees
  • merge_openchannel_htlc_state_machine
  • modern_fee_negotiation
  • more_release_notes
  • move-webapi-to-electrum-merchant
  • move_commands_to_init
  • move_constants
  • move_fonts_all_guis
  • move_hw_wallet
  • mpp_aggregate
  • multisig_wizard
  • mutinynet
  • mv_android
  • network_dialog_connect_combo
  • network_use_bookmarks
  • new_lightning
  • no-local-inputs
  • no_addr_keys_for_requests
  • no_dynfee_estimates
  • no_set_label
  • no_storage_sync
  • node_ann_dns
  • nostr_proxy
  • nostr_relays_config_description
  • nostr_swap_server_wait_unlock
  • notarytool
  • nsis-test
  • nwc
  • nwc_incoming_event_filtering
  • onion_messages
  • onion_messages_cleanup
  • onion_messages_unittest
  • open_channel_dialog_fix
  • open_channel_with_max
  • open_channel_without_signing
  • osx_sign_self_signed_cert
  • p4a_cryptodome
  • pass_paysession_in_route_building
  • password_lineedit
  • payment_sent_colon
  • persist_lnwatcher
  • plugin-commands
  • plugin_config_vars
  • plugin_manifest_json
  • plugin_pubk_user_prompt
  • plugin_update
  • plugins_import_dir_and_zip
  • plugins_in_wizard
  • prepare_standalone_ecc
  • prevent_fail_swap_exception
  • prevent_swapserver_spam
  • privacy_analysis
  • privacy_analysis2
  • proper_cleanup_after_swap_failed
  • psbt_nostr
  • psbt_nostr_ephemeral_event
  • psbt_nostr_fixes
  • psbt_nostr_proxy
  • psbt_nostr_qml_choices
  • psbt_nostr_send_description
  • psbt_nostr_verify_authors
  • pull/9613
  • pull/9781
  • pull/9797
  • pull/9986
  • qabstractitemmodel
  • qml_bip21_request_if_label_or_amount
  • qml_buttons
  • qml_calc_max_amount
  • qml_change_to_lightning_option
  • qml_channelopener_user_feedback
  • qml_close_invoicedialog_after_onchain_broadcast_success
  • qml_create_storage_exc
  • qml_dashboard
  • qml_feebump_cancel_txmon_fixes
  • qml_fix_forceclose_exception
  • qml_forward_swap_user_tx_finalize
  • qml_freeze_reused_address_utxos
  • qml_input_output_color
  • qml_invoice_dialog
  • qml_invoice_validation_error
  • qml_issue_noamt_lninvoice_sticky_override_amt
  • qml_lightning_invoice_insufficient_balance
  • qml_lnurl_amount
  • qml_nostr_servers_config
  • qml_oneserver
  • qml_pressandhold
  • qml_psbt_nostr_toggle
  • qml_psbt_over_nostr
  • qml_send_to_same_address_invoice_status_fix
  • qml_singletons
  • qml_swap_success_popup
  • qml_swapserver_ordering
  • qml_terms_of_use
  • qml_timestamp_precision
  • qml_txdetails_update_on_feehistogram
  • qml_txdialog_sane_values
  • qt6
  • qt_expired_invoice
  • qt_fiat_fixes
  • qt_network_layout_to_widgets
  • qt_network_tab_move_sentence
  • qt_no_request_details_when_multiple_selected
  • qt_paytoedit_completer
  • qt_richlabel
  • qt_seedwidget_copy_button
  • qt_standardmodel
  • qt_swaps_handle_usercancelled
  • qt_transaction_invoice_label
  • qt_vkbd
  • rbf_batch
  • rbf_swap
  • recursive_config
  • refactor_htlc_handling
  • refactor_trampoline_forwarding
  • refactored_watcher
  • regtest_lnd
  • release_channel
  • release_notes_4_5_1
  • remove_multi_hop_legacy_trampoline_option
  • remove_outdated_anchor_localtx
  • remove_pbkdf2
  • replace_pgp_pubkey
  • request_fclose_gossip
  • request_gossip
  • requirements
  • reserve_input_check_make_unsigned_transaction
  • resumable_channels
  • resumable_channels2
  • save_without_broadcast
  • send_change_to_lightning
  • settings_dialog
  • simnet
  • simple_parser
  • simpler_ui
  • simplify_lnsweep
  • simplify_subswap_fee
  • split_noise
  • static_remotekey
  • storage_db
  • structured_plugin_storage
  • submarine_swaps
  • support_3rd_party_signers_release_sh
  • swap_announce_liquidity
  • swap_cb
  • swap_cleanup_check
  • swap_dialog_followup
  • swap_dm_relays
  • swap_fee_slider
  • swap_nostr_event_type
  • swap_prepayment_fix
  • swaps_over_nostr
  • swaps_over_nostr_qml
  • swaps_prepayment
  • swapserver_icon
  • swapserver_plugin
  • swapserver_show_amounts
  • sweep_anchors
  • terms_of_use_separate
  • test_is_private_netaddress_expand
  • test_travis
  • timelockrecovery
  • trampoline
  • trustedcoin_kivy
  • txbatcher_clean_local_tx
  • txbatcher_do_not_remove_local_tx
  • txbatcher_fix_to_sweep_now
  • txbatcher_notenoughfunds
  • txbatcher_without_password_in_memory
  • txbatcherror
  • unique_password
  • update_appimagetool
  • update_notifications
  • update_swap_liquidity_on_events
  • updated_mainnet_fallback_nodes
  • use_asyncio_dnspython_methods
  • use_change_cb
  • use_electrum_ecc
  • use_ephemeral_dm
  • use_relays_directly
  • userspace_plugins_v2
  • verify_events
  • wallet_rename
  • wallet_requires_unlock
  • wallet_stop_and_start
  • warning_on_close
  • watcher_db
  • watchtower
  • watchtower_plugin
  • whitepaper_waiting_dialog
  • windows_disable_screenshot

18 May 2025 03:20PM UTC coverage: 59.794% (+0.3%) from 59.53%
4993842472026112

Pull #9839

CirrusCI

SomberNight
transaction: add method verify_sig_for_txin

This new `Transaction.verify_sig_for_txin` function is an instance method of `Transaction` instead of `PartialTransaction`.
It takes a complete txin, a pubkey and a signature, and verifies the signature.

- `get_preimage_script` is renamed to `get_scriptcode_for_sighash` and now effectively has two implementations:
  - the old impl became `PartialTxInput.get_scriptcode_for_sighash`
    - this assumes we are the ones constructing a spending txin and can have knowledge beyond what will be revealed onchain
  - the new impl is in the base class, `TxInput.get_scriptcode_for_sighash`
    - this assumes the txin is already "complete", and mimics a consensus-verifier by extracting the required fields
      from the already complete witness/scriptSig and the scriptpubkey of the funding utxo
- `serialize_preimage` now does not require a PartialTransaction, it also works on the base class Transaction

-----

I intend to use this for debugging only atm: I noticed TxBatcher sometimes creates invalid signatures by seeing
that bitcoind rejects txs with `mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)`.
However the txs in question have multiple txins, with some txins containing multiple signatures, and bitcoind does not tell us
which txin/signature is invalid. Knowing which signature is invalid would be a start, but I can now add some temp debug logging
to `serialize_preimage` to compare the message being signed with the message being verified.

As can be seen from the tests, the signature and the pubkey needs to be manually extracted from the txin to be verified:
we still don't have a script interpreter so we don't have logic to "verify a txin". However this new code adds logic
to verify a signature for a txin/pubkey combo (which is a small part of an interpreter/verifier).
Pull Request #9839: transaction: add method verify_sig_for_txin

156 of 178 new or added lines in 1 file covered. (87.64%)

557 existing lines in 7 files now uncovered.

21631 of 36176 relevant lines covered (59.79%)

2.99 hits per line

Relevant lines Covered
Build:
Build:
36176 RELEVANT LINES 21631 COVERED LINES
2.99 HITS PER LINE
Source Files on 202505_transaction_verify_sig_2
  • Tree
  • List 87
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
49938424... 202505_transaction_verify_sig_2 transaction: add method verify_sig_for_txin This new `Transaction.verify_sig_for_txin` function is an instance method of `Transaction` instead of `PartialTransaction`. It takes a complete txin, a pubkey and a signature, and verifies the signature... Pull #9839 18 May 2025 03:30PM UTC SomberNight CirrusCI
59.79
See All Builds (12275)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc