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.
This commit is contained in:
@@ -304,8 +304,7 @@ class BitcoinPurple(AbstractNet):
|
||||
}
|
||||
XPUB_HEADERS_INV = inv_dict(XPUB_HEADERS)
|
||||
|
||||
# Provisional BIP44 coin type (not SLIP-0044 registered; matches BTCP P2P port)
|
||||
BIP44_COIN_TYPE = 13496
|
||||
BIP44_COIN_TYPE = 13496 # provisional private constant (not SLIP-0044 registered)
|
||||
LN_REALM_BYTE = 0
|
||||
LN_DNS_SEEDS = []
|
||||
|
||||
|
||||
+1
-1
@@ -519,7 +519,7 @@ Modelled after the `AbstractNet` interface (see `pallectrum` for a working examp
|
||||
| `BOLT11_HRP` | `"btcp"` | `"tbtcp"` | LN invoice prefix |
|
||||
| `GENESIS` | `000003823f…c015` | `000002fdc3…d998` | full hashes in §2.5 / §3 |
|
||||
| `DEFAULT_PORTS` | `{'t':'50001','s':'50002'}` | `{'t':'60001','s':'60002'}` | |
|
||||
| `BIP44_COIN_TYPE` | **TBD / private project constant** | `1` | not registered for BitcoinPurple — see note |
|
||||
| `BIP44_COIN_TYPE` | `13496` (provisional — not SLIP-0044 registered) | `1` | matches BTCP P2P port; update when registered |
|
||||
| `LN_REALM_BYTE` | `0` | `1` | LN DNS realm byte; unused while `LN_DNS_SEEDS=[]` |
|
||||
| `LN_DNS_SEEDS` | `[]` | `[]` | no LN seeds configured |
|
||||
| `SKIP_POW_DIFFICULTY_VALIDATION` | `False` only after BTCP retarget support | `False` only after BTCP retarget support | see §7.7 |
|
||||
|
||||
@@ -172,7 +172,7 @@ class TestBitcoinPurpleConstants(ElectrumTestCase):
|
||||
|
||||
def test_bip44_coin_type(self):
|
||||
self.assertEqual(13496, BitcoinPurple.BIP44_COIN_TYPE)
|
||||
self.assertEqual(1, BitcoinPurpleTestnet.BIP44_COIN_TYPE)
|
||||
self.assertEqual(1, BitcoinPurpleTestnet.BIP44_COIN_TYPE)
|
||||
|
||||
# --- NETS_LIST integrity ---
|
||||
|
||||
|
||||
@@ -1375,6 +1375,7 @@ class TestPeerDirect(TestPeer):
|
||||
for i in range(num_payments):
|
||||
lnaddr, pay_req = self.prepare_invoice(w2, amount_msat=payment_value_msat)
|
||||
await group.spawn(single_payment(pay_req))
|
||||
await asyncio.sleep(0) # flush pending revoke_and_ack before stopping message loops
|
||||
gath.cancel()
|
||||
gath = asyncio.gather(many_payments(), p1._message_loop(), p2._message_loop(), p1.htlc_switch(), p2.htlc_switch())
|
||||
with self.assertRaises(asyncio.CancelledError):
|
||||
|
||||
Reference in New Issue
Block a user