Commit Graph

20068 Commits

Author SHA1 Message Date
davide b5fa01edfc fix: resolve UnknownBaseUnit crash in QML btcAmountRegex for non-BTC chains
Replace hardcoded \"BTC\" with get_base_units_list()[0] so the top-level
unit name is resolved dynamically from chain constants (e.g. \"BTCP\" for
BitcoinPurple), preventing the UnknownBaseUnit exception on receive screen.
2026-05-06 21:55:04 +02:00
davide 0da9670a36 docs: add CHANGELOG.md for Electrum Purple 0.9.0 2026-05-06 14:29:43 +02:00
davide b193282766 docs: rename tecnichal-data.md to technical-data.md (fix typo) 2026-05-06 14:26:37 +02:00
davide 12881fc477 feat: recolor desktop icon to purple (hue 278°, matching Android icons) 2026-05-06 14:02:38 +02:00
davide f0654310e1 fix: add seccomp=unconfined and SYS_PTRACE to Windows Docker build for WSL2 Wine compatibility 2026-05-06 13:27:16 +02:00
davide 3f90a46fa5 gitignore: ignore egg-info metadata 2026-05-06 11:06:13 +02:00
davide 013d234348 appimage: update type2 runtime xz pin 2026-05-06 11:05:02 +02:00
davide f3c376d8f4 docs: add Davide Grilli as BitcoinPurple fork author in AUTHORS 2026-05-06 10:25:40 +02:00
davide 39d65bb454 docs: add Davide Grilli copyright to LICENCE for BitcoinPurple fork additions 2026-05-06 10:25:06 +02:00
davide 13f8be46b3 docs: update README to identify Electrum Purple as unofficial BitcoinPurple fork by Davide Grilli 2026-05-06 10:24:21 +02:00
davide 4fc74d5510 fix: correct broken electrum-purple symlink (was ../run_electrum, now run_electrum) 2026-05-06 10:20:28 +02:00
davide 63e76fb088 fix: update Qt wizard icon reference to electrum-purple.png 2026-05-06 10:20:04 +02:00
davide 029ec7ab2d fix: use dynamic Config.baseUnitsList in Preferences.qml instead of hardcoded BTC names 2026-05-06 10:04:24 +02:00
davide 5ddbb637fa fix: expose baseUnitsList as QML property for network-aware unit names 2026-05-06 10:04:02 +02:00
davide 7e782baa73 fix: correct stale 'electrum' references in build scripts and Java classes
- apprun.sh: exec electrum-purple (was: electrum) — AppImage would fail to launch
- electrum-purple.nsi: shortcuts point to electrum-purple-VERSION.exe (was: electrum-VERSION.exe)
- SimpleScannerActivity.java: import org.electrumpurple.electrum_purple.res.R
- BiometricActivity.java: import org.electrumpurple.electrum_purple.res.R + title Electrum Purple
- run_electrum: is_local check looks for electrum-purple.desktop
2026-05-06 09:54:30 +02:00
davide 55f2ba2586 fix: update setup.py data_files and pyinstaller.spec for electrum-purple rename 2026-05-06 09:14:39 +02:00
davide 2ab945833a chore: update Android buildozer spec for Electrum Purple 2026-05-06 09:10:32 +02:00
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