9403 Commits

Author SHA1 Message Date
davide 9a93bfda83 fix: replace put_nowait+sleep polling with call_later in onion_message queues
The send_queue and forward_queue loops were doing put_nowait + sleep(SLEEP_DELAY)
+ get() to re-schedule not-yet-due messages. Under asyncio scheduler pressure the
get() can stall after the item was already put back, causing test_request_and_reply
to time out. Replaced with call_later(remaining, queue.put_nowait, item) which
schedules the re-insertion at the exact due time without any polling.
2026-05-05 09:45:09 +02:00
davide d51076cb0c feat: network-aware coin name and unit strings
Add COIN_SYMBOL/COIN_NAME to AbstractNet (defaults: BTC/Bitcoin).
BitcoinPurple overrides to BTCP/Bitcoin Purple; testnet inherits.

Replace module-level base_units/base_units_list in util.py with
get_base_units()/get_base_units_list() that read constants.net.COIN_SYMBOL
at runtime, producing [BTCP, mBTCP, bits, sat] on BitcoinPurple.

Update all UI touch points: Qt window title, watching-only warning,
invalid address message, testnet warning, settings unit combo + help
text, QML networkName property, and Preferences thousands-separator label
2026-04-29 15:05:33 +02:00
davide 8b8d958a45 config: default network to BitcoinPurple mainnet
Change get_selected_chain() fallback from BitcoinMainnet to BitcoinPurple
so the wallet starts on the BTCP network when no --<chain> flag is passed
2026-04-29 14:56:26 +02:00
davide d1088c036e blockchain: generalize difficulty adjustment for per-chain PoW constants
get_target(): replace hardcoded Bitcoin constants (CHUNK_SIZE, 14-day
timespan, module-level MAX_TARGET) with per-chain values from constants.net.
Handle POW_GENESIS_BITS so that chains whose genesis nBits differs from
target_to_bits(MAX_TARGET) return the correct initial difficulty for period 0.
Map checkpoint indices correctly when adj_interval != CHUNK_SIZE.

verify_chunk(): add a separate code path for chains where the retarget
interval is shorter than CHUNK_SIZE (e.g. BTCP: 120 vs 2016).  In this
case multiple retargets can occur within a single chunk; because the headers
are not yet on disk during verification, reading via read_header() would
raise MissingHeader and reject the entire chunk.  Fix by reading from the
in-memory data buffer via a local helper _read_hdr(), and tracking
current_target across period boundaries inline.

can_connect(), chainwork_of_header_at_height(): use adj_interval instead of
CHUNK_SIZE when computing the difficulty-period index so that BTCP's 120-block
retarget windows are respected
2026-04-29 10:08:14 +02:00
davide e0d04af154 constants: add BitcoinPurple (BTCP) and BitcoinPurpleTestnet network classes
Add per-chain PoW fields to AbstractNet (DIFFICULTY_ADJUSTMENT_INTERVAL,
POW_TARGET_TIMESPAN, MAX_TARGET, MAX_ADJUSTMENT_FACTOR, POW_GENESIS_BITS)
with Bitcoin defaults so existing chains are unaffected.

Add BitcoinPurple and BitcoinPurpleTestnet as independent AbstractNet subclasses
with BTCP-specific parameters:
- 120-block retarget interval, 7200-second target timespan
- powLimit 0x1e0fffff, genesis nBits 0x1e0ffff0 (POW_GENESIS_BITS)
- P2PKH prefix 56 (0x38), P2SH 55 (0x37), WIF 0xb7, bech32 HRP "btcp"/"tbtcp"
- SLIP-0132 HD key headers identical to Bitcoin mainnet/testnet respectively
- ElectrumX default ports 50001/50002 (mainnet) and 60001/60002 (testnet)

Add chain data directories:
- electrum/chains/bitcoinpurple/{servers,checkpoints,fallback_lnnodes}.json
- electrum/chains/bitcoinpurple_testnet/{servers,checkpoints,fallback_lnnodes}.json
servers.json is populated with 5 known BTCP ElectrumX nodes (TCP 51001, SSL 51002)
2026-04-29 10:07:54 +02:00
SomberNight 3399c20ad6 commands: export_lightning_preimage: add comment about wallet password 2026-04-28 15:16:42 +00:00
ThomasV c964fdef6d Merge pull request #10544 from spesmilo/lazy_trampoline
Lazy trampoline
2026-04-28 10:45:14 +02:00
ThomasV b776daca36 Merge pull request #10613 from SomberNight/202604_crash_report_altcoin
crash_reporter: detect more altcoin-forks, don't send reports
2026-04-28 10:29:57 +02:00
ThomasV 187ea80688 lazy_trampoline: adapt unit test 2026-04-28 10:22:10 +02:00
ThomasV f3a8dd61bb lazy trampoline:
If a trampoline forwarder fails to find a path, it may return a list
of trampolines it knows how to reach, so that clients can add these
trampolines to their route.

The list of trampolines and fees is written in the error data of
the 'update_fail_htlc' message.
2026-04-28 10:22:10 +02:00
ThomasV df5c8c4c98 create_routes_for_payment: allow trampoline forwarding without channel_db if there is a direct path 2026-04-28 10:20:57 +02:00
ThomasV 5a31bf6aa0 Merge pull request #10463 from f321x/jit_2
lnwallet: zeroconf/just-in-time improvements and tests
2026-04-28 10:16:34 +02:00
ghost43 044c00a449 Merge pull request #10585 from f321x/qml_eltextarea_padding
qml: ElTextArea default topPadding, hide placeholderText on input
2026-04-27 17:55:10 +00:00
ghost43 f60cdb0f40 Merge pull request #10614 from f321x/lnaddr_rename
bolt11: rename *lnaddr* -> *bolt11*
2026-04-27 15:31:30 +00:00
SomberNight b0a5e2010c bolt11: follow-up renames 2026-04-27 15:28:39 +00:00
SomberNight d2700dfbca qml: BalanceDetails: fix typo 2026-04-27 15:04:38 +00:00
f321x 560d90e8b8 qt, watchtower: cleanup imports 2026-04-27 16:28:24 +02:00
f321x 306cac192b lnaddr: rename LnAddr -> bolt11
The LnAddr, lndecode and lnencode naming didn't imply that it is
bolt 11 specific, making it confusing to work with, now that there are
also bolt 12 "lnaddr".
Renaming it to *bolt11* creates a clear separation to bolt 12 things and
reduces mental load.

This commit is pure renaming (using the PyCharm IDE refactor function),
except for the removal of the `object` inheritance of LnAddr/BOLT11Addr,
this is Python 2 legacy.
2026-04-27 16:28:19 +02:00
SomberNight 3534f62b0b crash_reporter: detect more altcoin-forks, don't send reports
A new crash report [0] looks to be from a fork where the altcoin has the same genesis block [1] as Bitcoin.
But ofc "branding" is important, so they updated the URLs to point to their fork -- so we could also test against that.

[0]: https://github.com/spesmilo/electrum/issues/10610
[1]: https://github.com/palladium-coin/pallectrum/blob/0df81c6af8d36f3549739576681d3df9969e32fd/electrum/constants.py#L194
2026-04-27 14:16:29 +00:00
f321x 6872637053 qml: ElTextArea: hide placeholder text on user input
When the user enters something into the ElTextArea the placeholder
text should be hidden so it doesn't conflict with the user input.
This affects e.g. the lnurl pay dialog.
2026-04-27 13:20:40 +02:00
f321x 9079badfdb qml: add default topPadding to ElTextArea
I noticed all ElTextAreas seem to look better with some topPadding,
so it makes more sense to add it as default to ElTextArea.
Followup to https://github.com/spesmilo/electrum/pull/10579
2026-04-27 13:20:40 +02:00
ghost43 9b26c1812d Merge pull request #10485 from accumulator/ndk28_qt610_rebase_p4a
p4a rebase, use ndk28 and qt6.10
2026-04-24 17:06:25 +00:00
ghost43 cc1874c9c9 Merge pull request #10575 from f321x/lnurlw_prefix
pi: handle lud-17 lnurl URIs
2026-04-24 15:00:07 +00:00
ghost43 8be4f8c8cf Merge pull request #10606 from f321x/trampoline_route_fees
trampoline: handle edges with known fees during route edge fee allocation
2026-04-24 14:46:40 +00:00
SomberNight b483e0d163 trampoline: _allocate_fee_budget_among_route: followup comment 2026-04-24 14:41:48 +00:00
f321x 6933faee32 trampoline: handle edges with known fees in allocation
Handle `TrampolineEdge` with known fees when allocating fees to
`TrampolineEdge` with `PLACEHOLDER_FEE` during trampoline route
construction.

This allows to create a mixed route from edges where we know the exact
feerates (e.g. provided through lazy trampoline) and evenly spread the
remaining budget between the edges where the fees are unknown (`PLACEHOLDER_FEE`).

Co-Authored-By: SomberNight <somber.night@protonmail.com>
2026-04-24 16:34:46 +02:00
ghost43 ca212da72a Merge pull request #10605 from f321x/crash_reporter_start_new_window
qt: send start_new_window exc to reporter
2026-04-24 14:05:36 +00:00
SomberNight 5af40f435a Merge branch '202604_pr10603_ledger'
adapt Ledger_Client_Legacy to work with newer ledger bitcoin app

manual merge of https://github.com/spesmilo/electrum/pull/10603
2026-04-24 13:57:23 +00:00
f321x c8c44e354c qt: send start_new_window exc to reporter
Send more types of exceptions happening during daemon.load_wallet
in `ElectrumGui.start_new_window()` to the crash reporter to catch
e.g. assertion failures instead of showing them to the user as a warning
dialog.
2026-04-24 15:54:56 +02:00
ghost43 b9dc6aa34c Merge pull request #10591 from SomberNight/202604_fix_wallet_mktx_base_tx
wallet: make_unsigned_tx: fix base_tx for GUI simple-send batching
2026-04-24 13:01:24 +00:00
ghost43 e96b833fe7 Merge pull request #10592 from SomberNight/202604_testnet_mainnet_mixup2
wallet_db: put 'genesis_blockhash' in DB, detect mainnet/testnet mixup. (db upgrade)
2026-04-24 12:59:31 +00:00
f321x 5a0c052384 onion_message: move round-robin logic in Request method 2026-04-24 14:00:16 +02:00
f321x 3ff3205b19 onion_message: use util.random_shuffled_copy instead rand sort 2026-04-24 14:00:16 +02:00
f321x d31d1cf75e onion_message: simplify send_onion_message_to
Remove the hops data encryption from the blinded path branch of
send_onion_message_to. Our hops data is already encrypted before
and the blinded paths hops data is already encrypted by the recipient,
so this is a no-op.

Also use encrypt_hops_recipient_data in create_route_to_introduction_point,
it does the same as the existing encryption step.
2026-04-24 14:00:16 +02:00
Ilya Artemov 44570bfa3b Bump minimum required version of ledger_bitcoin (build-time and runtime) 2026-04-24 09:09:00 +02:00
ghost43 294fdd1267 Merge pull request #10604 from f321x/dedup_valid_wallet_name
qml: deduplicate wallet name validation
2026-04-23 14:30:13 +00:00
f321x d34129ef5c qml: deduplicate wallet name validation
Deduplicates the wallet name validation between wizard and daemon.
2026-04-23 16:11:36 +02:00
ThomasV 7c433c5645 rm 'received orphan channnel' log line (too verbose) 2026-04-23 09:29:08 +02:00
ghost43 230e627559 Merge pull request #10600 from SomberNight/202604_lnpeer_chan_reest
lnpeer: channel_reestablish: split "they_are_ahead" into ctn vs revnum
2026-04-22 16:27:10 +00:00
SomberNight 46eadbf442 lnpeer: channel_reestablish: further restrict states for msg handler
re REQUESTED_FCLOSE and WE_ARE_TOXIC (as per f321x):
> There is no reason for the peer to send channel_reestablish after we
> have sent the force close request (error) and I assume we don't
> want to give surface to the peer to attempt finding out if we really lost state?

re FORCE_CLOSING:
the peer might not have realised we started force-closing but we probably don't want to run the message-handler even in that case
2026-04-22 15:57:18 +00:00
Sander van Grieken f2e8b466cd qml: add type hints for QVariant pyqtProperty workarounds 2026-04-22 10:15:30 +02:00
Sander van Grieken 3f34e6bee0 qml: additional styling InfoTextArea in dialogs 2026-04-22 10:15:30 +02:00
Sander van Grieken 31b1974089 qml: FlatButton: show indicator for press-and-hold functionality 2026-04-22 10:15:30 +02:00
Sander van Grieken 8e78d74723 qml: remove unused components 2026-04-22 10:15:30 +02:00
Sander van Grieken 3c5dc66068 qml: various styling updates 2026-04-22 10:15:30 +02:00
Sander van Grieken 7c83e749ef icons: square closebutton.png and copy_bw.png so they don't resize on highlight (qml)
and upscale qrcode-[_white].png for the same reason and so we don't need to apply scaling
2026-04-22 10:15:30 +02:00
Sander van Grieken 895679a6be qml: styling History, ProxyConfig and NostrConfigDialog 2026-04-22 10:15:30 +02:00
Sander van Grieken 87bb63e442 qml: use standard Button for buttons outside of buttoncontainer 2026-04-22 10:15:30 +02:00
Sander van Grieken 3a740256c5 qml: add missing button containers 2026-04-22 10:15:30 +02:00
Sander van Grieken 1c0851c6eb styling OpenChannelDialog 2026-04-22 10:15:30 +02:00