Commit Graph

20051 Commits

Author SHA1 Message Date
davide 2a7cf8278b chore: rename NSIS installer script and update for Electrum Purple
- Rename contrib/build-wine/electrum.nsi to electrum-purple.nsi
- Update PRODUCT_NAME from "Electrum" to "Electrum Purple"
- Update PRODUCT_WEB_SITE to https://github.com/DavideGrilli/electrum
- Update PRODUCT_PUBLISHER to "Electrum Purple"
- Update OutFile to dist/electrum-purple-setup.exe
- Update icon references to electrum-purple.ico
- Update exe references to electrum-purple-${PRODUCT_VERSION}.exe
- Update build-electrum-git.sh to reference new NSI filename
- Update NAME_ROOT to electrum-purple in build-electrum-git.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:08:46 +02:00
davide 1a09d60a95 chore: update AppImage build script for electrum-purple naming 2026-05-06 09:04:25 +02:00
davide 99f11fc5cb chore: update icon references from electrum.png to electrum-purple.png 2026-05-06 09:03:08 +02:00
davide d22bd6c379 chore: rename electrum.png and electrum.ico to electrum-purple.* 2026-05-06 09:03:02 +02:00
davide 1ae12899f6 chore: fix stale comment in electrum-purple.desktop 2026-05-06 09:01:37 +02:00
davide 729a0081a5 chore: rename desktop and metainfo files for Electrum Purple 2026-05-06 08:57:35 +02:00
davide 90f567d57b chore: rename pip package to electrum-purple, entry point to electrum-purple 2026-05-06 08:52:31 +02:00
davide 645216003f chore: bump version to 1.0.0 for Electrum Purple fork 2026-05-06 08:49:03 +02:00
davide af19974381 fix: restore BIP44_COIN_TYPE=13496 for BitcoinPurple and fix LN stresstest race
BIP44_COIN_TYPE was accidentally set to 0 (Bitcoin mainnet), which would
cause BTCP wallets to derive keys identical to Bitcoin mainnet wallets from
the same seed. Restored to 13496 (provisional private constant matching the
BTCP P2P port) per tecnichal-data.md spec; updated table entry and test.

Also fixes a race condition in TestPeerDirectAnchors::test_payments_stresstest:
gath.cancel() was called immediately after OldTaskGroup exited, without any
await, so the event loop never ran the message-loop tasks to drain the final
revoke_and_ack for the last batch of 5 concurrent HTLCs. Added
asyncio.sleep(0) to yield one event-loop iteration before cancelling.
2026-05-05 19:26:26 +02:00
davide a959456683 docs: add BitcoinPurple technical reference
Comprehensive parameter reference for BTCP node operators and
developers: network params, ElectrumX coin definition, Electrum
constants.py, Lightning Network chain parameters and timeout scaling
2026-05-05 17:49:57 +02:00
davide 374d1c6b60 ui: recolor icons blue → purple for BitcoinPurple branding
SVG gradient stops updated directly; PNG files processed with a
+65° HSV hue rotation on blue-range pixels (185–245°, sat > 0.15),
preserving transparency, black, and white unchanged
2026-05-05 14:11:29 +02:00
davide f4d2d0adea docs: add test suite report for BitcoinPurple Electrum (1005 passed, 6 skipped)
Full run: pytest tests -v, Python 3.12.3, pytest 9.0.3, ~3:30 min.

Documents pass/skip counts per file, reasons for the 6 upstream-skipped tests,

BTCP-specific coverage, and flaky test fixes applied in this session.
2026-05-05 14:10:48 +02:00
davide 5c406683b8 tests: use config.path instead of electrum_path for network-aware test dirs
SimpleConfig.path differs from electrum_path when the active network has a
subdirectory (e.g. BitcoinPurple mainnet). Tests that wrote directly to
electrum_path were resolving the wrong directory; use config.path consistently.
Also reorder setUp() so config is created before any path-dependent operations
2026-05-05 09:45:09 +02:00
davide 49ac312c88 tests: fix flaky LN peer tests (retries, timeouts, MPP wait loop)
- test_reestablish_fake_data: add 3-attempt retry per pay_invoice call to handle
  asyncio event-loop pressure on sequential payments
- test_htlc_switch_iteration_benchmark: raise timeout 2s → 5s
- test_payment_multipart_trampoline_e2e: attempts 1 → 3
- _run_trampoline_payment: default attempts 2 → 5; add outer retry loop catching
  NoPathFound (raised when all fee levels fail, bypassing the attempts counter)
- test_mpp_expiry (anchor): replace fixed asyncio.sleep with a polling loop that
  waits until bob has received both HTLCs before asserting MPP state
2026-05-05 09:45:09 +02:00
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 7d433d0b44 tests: fix flaky LN tests (MPP timeout and orphaned tasks)
Two fixes:

1. test_trampoline_mpp_consolidation: set dave.MPP_EXPIRY=120 when
   test_mpp_consolidation=True. With MPP_EXPIRY=2s and sequential HTLC
   commitment rounds, Dave times out before the second HTLC arrives.

2. test_reestablish_fake_data: use explicit Task references in the
   payment setup phase so that loop tasks (message loops, htlc_switch)
   are cancelled in a finally block regardless of whether pay() succeeds
   or raises. Without this, asyncio.gather leaves orphaned tasks running
   across sub-test iterations when a payment fails, causing interference
2026-04-29 16:04:29 +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 7b39a89d1c docs: add BitcoinPurple section to CLAUDE.md
Documents BTCP-specific PoW constants, the dual-path verify_chunk logic,
POW_GENESIS_BITS rationale, retarget clamping formula, relevant file paths,
run/test commands, and LN block-scaled timeout guidance
2026-04-29 14:55:57 +02:00
davide 6db4232825 docs: add tecnichal-data.md — BitcoinPurple technical reference
Complete parameter reference for BTCP node operators and developers:
network identity, mainnet/testnet/signet/regtest parameters, address
encoding, HD key version bytes, genesis block, consensus & emission
schedule, 120-block difficulty adjustment algorithm, soft-fork activation,
ElectrumX coin definition and Docker patch, Electrum constants.py reference,
checkpoints format, Lightning Network chain identification (chain_hash,
BOLT11 HRP, block-time-scaled timeout parameters), and bitcoinpurple.conf
annotated configuration
2026-04-29 10:12:04 +02:00
davide ea8f27358f docs: add quickstart.md (English)
Step-by-step setup guide covering system prerequisites, venv creation,
dependency installation (test-only and test+Qt/QML variants), running from
source (Bitcoin and BitcoinPurple networks, GUI/text/daemon modes), running
tests, and a project structure quick-reference table
2026-04-29 10:10:30 +02:00
davide 88525ef510 docs: add CLAUDE.md
Project guidance for Claude Code covering dev commands (install, run, test,
build translations), high-level architecture (entry/routing, core module
table, GUI backends, plugin system, async model, testing conventions)
2026-04-29 10:09:56 +02:00
davide 41e4a8141f tests: add BitcoinPurple test suite
46 tests across three classes:

TestBitcoinPurpleConstants — validates all BTCP network constants against
the technical specification: NET_NAME, TESTNET flags, CLI flags, address
prefixes (P2PKH 56, P2SH 55, WIF 0xb7), bech32/BOLT11 HRP, genesis hashes
and wire-order chain_hash, default ports, PoW parameters (adj_interval 120,
target_timespan 7200, MAX_TARGET, POW_GENESIS_BITS), SLIP-0132 HD key
headers, LN parameters, NETS_LIST uniqueness, and inheritance independence.

TestBitcoinPurpleDifficultyAdjustment — tests the 120-block retarget logic
using BitcoinPurple mainnet (testnet was wrong because get_target always
returns 0 on testnet).  Covers: genesis index returns genesis target from
POW_GENESIS_BITS, on-time/fast/slow adjustments, lower and upper clamp, the
120-block window (not 2016), and can_connect() calling get_target with the
correct period index.

TestBitcoinPurpleAddress — tests address encoding under BitcoinPurple: P2PKH
starts with 'P', bech32 with HRP 'btcp', address_to_script produces correct
P2WPKH scriptPubKey, WIF round-trip with prefix 0xb7, Bitcoin addresses
rejected on BTCP network
2026-04-29 10:08:33 +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 bd5ac019ce release notes: 4.7.2: add links to security disclosures 2026-04-28 17:07:00 +00: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
SomberNight 96a3345ab5 setup.py: "qml_gui" extra: update pyqt version 2026-04-24 16:48:34 +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 06fd088992 test_lnrouter: add unittests for tramp fee allocation
Adds `TestAllocateFeeBudget` for trampoline route fee allocation
coverage.

Co-Authored-By: SomberNight <somber.night@protonmail.com>
2026-04-24 16:34:52 +02: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