Add Palladium (PLM) coin
Palladium, PalladiumTestnet and PalladiumRegtest, with parameters from palladiumcore (address prefixes, RPC ports, genesis hashes). The daemon version/index requirements of the Bitcoin class are disabled, as Palladium Core is based on Bitcoin Core 0.19. Tests: chain params, address -> hashX, and mainnet block/transaction fixtures taken from a synced node. The altcoin transaction test skips the address check for witness outputs, as bech32 is not supported by Coin.address_to_hashX. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
384d907c65
commit
26aac61cae
9 files changed
+448
No files matched your search
@@ -75,6 +75,15 @@ addresses = [
|
||||
"8687b01c03f47615226bdf54443f172d8eb523c6", "318a000ccf626685c8c213"),
|
||||
(coins.GravityZeroCoin, "GJPaFtL7ffbFPQKbPoLn2PvgajQ48QGo67",
|
||||
"05fc7b8c8ba198dedb4d14223aeb709436373d6b", "bd8fa7f0c7b50b023ac0c6"),
|
||||
# addresses and scripts from palladiumcore src/test/data/key_io_valid.json
|
||||
(coins.Palladium, "PHrYiyUQTSekTWvVBNMEnSzV1DCB9TGR2P",
|
||||
"65a16059864a2fdbc7c99a4723a8395bc6f188eb", "0fae27c959f6b69f711a9e"),
|
||||
(coins.Palladium, "3CMNFxN1oHBc4R1EpboAL5yzHGgE611Xou",
|
||||
"74f209f6ea907e2ea48f74fae05782ae8a665257", "0ec76b02c1f59dcc3d8b6c"),
|
||||
(coins.PalladiumTestnet, "tEZSNGVUiXapct4zsnZcfz9CfqKhmUqguv",
|
||||
"53c0307d6851aa0ce7825ba883c6bd9ad242b486", "bec4c9c9872501d067633d"),
|
||||
(coins.PalladiumTestnet, "oRvMM9SjaZ8LpnNkN7R8MLj5ZtADdTxKan",
|
||||
"6349a418fc4578d10a372b54b45c280cc8c4382f", "272f0d99c753fb3af434aa"),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Tests of the Palladium coin classes (parameters from palladiumcore src/chainparams.cpp)
|
||||
|
||||
import pytest
|
||||
|
||||
from electrumx.lib import tx as lib_tx
|
||||
from electrumx.lib.coins import Coin, Palladium, PalladiumTestnet, PalladiumRegtest
|
||||
|
||||
# (class, net, rpc port, P2PKH verbyte, P2SH verbyte, genesis hash)
|
||||
PARAMS = [
|
||||
(Palladium, "mainnet", 2332, "37", "05",
|
||||
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"),
|
||||
(PalladiumTestnet, "testnet", 12332, "7f", "73",
|
||||
"000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"),
|
||||
(PalladiumRegtest, "regtest", 28443, "7f", "73",
|
||||
"0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("coin,net,rpc_port,p2pkh,p2sh,genesis", PARAMS)
|
||||
def test_chain_params(coin, net, rpc_port, p2pkh, p2sh, genesis):
|
||||
assert coin.NAME == "Palladium"
|
||||
assert coin.NET == net
|
||||
assert coin.RPC_PORT == rpc_port
|
||||
assert coin.P2PKH_VERBYTE == bytes.fromhex(p2pkh)
|
||||
assert coin.P2SH_VERBYTES == (bytes.fromhex(p2sh),)
|
||||
assert coin.GENESIS_HASH == genesis
|
||||
assert coin.BASIC_HEADER_SIZE == 80
|
||||
assert coin.DESERIALIZER is lib_tx.DeserializerSegWit
|
||||
|
||||
|
||||
@pytest.mark.parametrize("coin,net", [(c, n) for c, n, *_ in PARAMS])
|
||||
def test_lookup_coin_class(coin, net):
|
||||
assert Coin.lookup_coin_class("Palladium", net) is coin
|
||||
assert Coin.lookup_coin_class("palladium", net.upper()) is coin
|
||||
|
||||
|
||||
def test_daemon_requirements_disabled():
|
||||
# Palladium Core (Bitcoin Core 0.19 based) has no getindexinfo/txospenderindex
|
||||
for coin, *_ in PARAMS:
|
||||
assert coin.MIN_REQUIRED_DAEMON_VERSION is None
|
||||
assert not coin.REQUIRED_DAEMON_INDEXES
|
||||
Reference in new issue
Block a user