From 37cc8b9cf91e4dad4833df2fb88009e02505adde Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Fri, 20 Feb 2026 16:15:16 +0100 Subject: [PATCH] feat: Update network references from bitcoin to palladium and add `palladiumd` RPC warmup retry logic. --- bitcoin/chainparams.c | 57 +---------------- bitcoin/test/run-bitcoin_block_from_hex.c | 2 +- bitcoin/test/run-psbt-from-tx.c | 2 +- ...-tx-bitcoin_tx_2of2_input_witness_weight.c | 2 +- bitcoin/test/run-tx-encode.c | 2 +- common/bolt12.c | 2 +- common/configdir.c | 4 +- common/test/run-bolt11.c | 14 ++--- common/test/run-bolt12-encode-test.c | 4 +- common/test/run-psbt_diff.c | 2 +- contrib/pyln-testing/pyln/testing/utils.py | 59 ++++++++++++------ lightningd/lightning_gossip_compactd | Bin 1594968 -> 1594968 bytes lightningd/options.c | 4 +- plugins/bcli.c | 21 ++++++- tests/autogenerate-rpc-examples.py | 10 +-- tests/fuzz/fuzz-addr.c | 2 +- tests/fuzz/fuzz-close_tx.c | 2 +- tests/fuzz/fuzz-full_channel.c | 2 +- tests/fuzz/fuzz-handle_onion_message.c | 2 +- tests/fuzz/fuzz-init_received.c | 2 +- tests/fuzz/fuzz-initial_channel.c | 2 +- tests/fuzz/fuzz-wireaddr.c | 2 +- tests/plugins/badestimate.py | 16 ++--- tests/plugins/bitcoin/part1.py | 8 +-- tests/test_db.py | 2 +- tests/test_gossip.py | 4 +- tests/test_misc.py | 2 +- tests/test_plugin.py | 4 +- tests/utils.py | 2 +- 29 files changed, 114 insertions(+), 123 deletions(-) diff --git a/bitcoin/chainparams.c b/bitcoin/chainparams.c index 8f7d56892..9fc8e5979 100644 --- a/bitcoin/chainparams.c +++ b/bitcoin/chainparams.c @@ -26,7 +26,7 @@ static u8 liquid_regtest_fee_asset[] = { }; const struct chainparams networks[] = { - {.network_name = "bitcoin", + {.network_name = "palladium", .onchain_hrp = "plm", .lightning_hrp = "plm", .bip70_name = "main", @@ -35,7 +35,7 @@ const struct chainparams networks[] = { 0xf7, 0x4f, 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c, 0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00}}}}, - .rpc_port = 2332, + .rpc_port = 2333, .ln_port = 9735, .cli = "palladium-cli", .cli_args = NULL, @@ -68,7 +68,7 @@ const struct chainparams networks[] = { 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f}}}}, - .rpc_port = 12443, + .rpc_port = 28444, .ln_port = 19846, .cli = "palladium-cli", .cli_args = "-regtest", @@ -111,57 +111,6 @@ const struct chainparams networks[] = { .bip32_key_version = {.bip32_pubkey_version = BIP32_VER_SIGT_PUBLIC, .bip32_privkey_version = BIP32_VER_SIGT_PRIVATE}, .is_elements = false, }, - {.network_name = "testnet", - .onchain_hrp = "tplm", - .lightning_hrp = "tplm", - .bip70_name = "test", - .genesis_blockhash = {{{.u.u8 = {0x43, 0x49, 0x7f, 0xd7, 0xf8, 0x26, 0x95, - 0x71, 0x08, 0xf4, 0xa3, 0x0f, 0xd9, 0xce, - 0xc3, 0xae, 0xba, 0x79, 0x97, 0x20, 0x84, - 0xe9, 0x0e, 0xad, 0x01, 0xea, 0x33, 0x09, - 0x00, 0x00, 0x00, 0x00}}}}, - .rpc_port = 12332, - .ln_port = 19735, - .cli = "palladium-cli", - .cli_args = "-testnet", - .cli_min_supported_version = 150000, - .dust_limit = { 546 }, - .max_funding = AMOUNT_SAT_INIT((1 << 24) - 1), - .max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL), - .max_supply = AMOUNT_SAT_INIT(2100000000000000), - .p2pkh_version = 127, - .p2sh_version = 115, - .testnet = true, - .fee_asset_tag = NULL, - .bip32_key_version = {.bip32_pubkey_version = BIP32_VER_TEST_PUBLIC, - .bip32_privkey_version = BIP32_VER_TEST_PRIVATE}, - .is_elements = false}, - {.network_name = "testnet4", - .onchain_hrp = "tplm", - .lightning_hrp = "tplm", - .bip70_name = "testnet4", - // 00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043 - .genesis_blockhash = {{{.u.u8 = {0x43, 0xf0, 0x8b, 0xda, 0xb0, 0x50, 0xe3, - 0x5b, 0x56, 0x7c, 0x86, 0x4b, 0x91, 0xf4, - 0x7f, 0x50, 0xae, 0x72, 0x5a, 0xe2, 0xde, - 0x53, 0xbc, 0xfb, 0xba, 0xf2, 0x84, 0xda, - 0x00, 0x00, 0x00, 0x00}}}}, - .rpc_port = 48332, - .ln_port = 49735, - .cli = "palladium-cli", - .cli_args = "-testnet4", - .cli_min_supported_version = 150000, - .dust_limit = { 546 }, - .max_funding = AMOUNT_SAT_INIT((1 << 24) - 1), - .max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL), - .max_supply = AMOUNT_SAT_INIT(2100000000000000), - .p2pkh_version = 127, - .p2sh_version = 115, - .testnet = true, - .fee_asset_tag = NULL, - .bip32_key_version = {.bip32_pubkey_version = BIP32_VER_TEST_PUBLIC, - .bip32_privkey_version = BIP32_VER_TEST_PRIVATE}, - .is_elements = false}, {.network_name = "liquid-regtest", .onchain_hrp = "ert", .lightning_hrp = "ert", diff --git a/bitcoin/test/run-bitcoin_block_from_hex.c b/bitcoin/test/run-bitcoin_block_from_hex.c index 0dc0bd640..8142eec00 100644 --- a/bitcoin/test/run-bitcoin_block_from_hex.c +++ b/bitcoin/test/run-bitcoin_block_from_hex.c @@ -79,7 +79,7 @@ int main(int argc, const char *argv[]) struct bitcoin_block *b; common_setup(argv[0]); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); b = bitcoin_block_from_hex(NULL, chainparams, block, strlen(block)); diff --git a/bitcoin/test/run-psbt-from-tx.c b/bitcoin/test/run-psbt-from-tx.c index 5af07b3c9..a679ebbe2 100644 --- a/bitcoin/test/run-psbt-from-tx.c +++ b/bitcoin/test/run-psbt-from-tx.c @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) size_t len; common_setup(argv[0]); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); msg = tal_arr(tmpctx, u8, 0); tx = bitcoin_tx_from_hex(tmpctx, raw_tx, strlen(raw_tx)); diff --git a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c index 47be0d726..1128057e2 100644 --- a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c +++ b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c @@ -25,7 +25,7 @@ int main(int argc, const char *argv[]) size_t weight; common_setup(argv[0]); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); memset(&h, 0, sizeof(h)); memset(&p, 1, sizeof(p)); diff --git a/bitcoin/test/run-tx-encode.c b/bitcoin/test/run-tx-encode.c index 404862fec..2b10fb2fe 100644 --- a/bitcoin/test/run-tx-encode.c +++ b/bitcoin/test/run-tx-encode.c @@ -35,7 +35,7 @@ static void hexeq(const void *p, size_t len, const char *hex) int main(int argc, const char *argv[]) { common_setup(argv[0]); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); struct bitcoin_tx *tx; diff --git a/common/bolt12.c b/common/bolt12.c index 4621e62f6..ddf368911 100644 --- a/common/bolt12.c +++ b/common/bolt12.c @@ -33,7 +33,7 @@ bool bolt12_chains_match(const struct bitcoin_blkid *chains, */ if (!chains) { max_num_chains = 1; - chains = &chainparams_for_network("bitcoin")->genesis_blockhash; + chains = &chainparams_for_network("palladium")->genesis_blockhash; } for (size_t i = 0; i < max_num_chains; i++) { diff --git a/common/configdir.c b/common/configdir.c index 8a68f5d10..c008ccf5f 100644 --- a/common/configdir.c +++ b/common/configdir.c @@ -323,7 +323,7 @@ struct configvar **initial_config_opts(const tal_t *ctx, opt_argv0 = argv[0]; /* Default chain (a global) is bitcoin. */ - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); /* First, they could specify a config, or base dir. */ *config_filename = NULL; @@ -352,7 +352,7 @@ struct configvar **initial_config_opts(const tal_t *ctx, opt_set_specific_network, "signet", "Alias for --network=signet"); opt_register_early_noarg("--mainnet", - opt_set_specific_network, "bitcoin", + opt_set_specific_network, "palladium", "Alias for --network=bitcoin"); opt_register_early_noarg("--regtest", opt_set_specific_network, "regtest", diff --git a/common/test/run-bolt11.c b/common/test/run-bolt11.c index bd8c2c662..9b5fcbc92 100644 --- a/common/test/run-bolt11.c +++ b/common/test/run-bolt11.c @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) * * `357wnc5r2ueh7ck6q93dj32dlqnls087fxdwk8qakdyafkq3yap9us6v52vjjsrvywa6rt52cm9r9zqt8r2t7mlcwspyetp5h2tztugp`: signature */ b11 = new_bolt11(tmpctx, NULL); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; if (!hex_decode("0001020304050607080900010203040506070809000102030405060708090102", strlen("0001020304050607080900010203040506070809000102030405060708090102"), @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) */ msatoshi = AMOUNT_MSAT(2500 * (1000ULL * 100000000) / 1000000); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; b11->payment_secret = tal(b11, struct secret); memset(b11->payment_secret, 0x11, sizeof(*b11->payment_secret)); @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) */ msatoshi = AMOUNT_MSAT(20 * (1000ULL * 100000000) / 1000); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; b11->payment_secret = tal(b11, struct secret); memset(b11->payment_secret, 0x11, sizeof(*b11->payment_secret)); @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) /* ALL UPPERCASE is allowed (useful for QR codes) */ msatoshi = AMOUNT_MSAT(2500 * (1000ULL * 100000000) / 1000000); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; b11->payment_secret = tal(b11, struct secret); memset(b11->payment_secret, 0x11, sizeof(*b11->payment_secret)); @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) */ msatoshi = AMOUNT_MSAT(25 * (1000ULL * 100000000) / 1000); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; if (!hex_decode("0001020304050607080900010203040506070809000102030405060708090102", strlen("0001020304050607080900010203040506070809000102030405060708090102"), @@ -564,7 +564,7 @@ int main(int argc, char *argv[]) */ msatoshi = AMOUNT_MSAT(967878534); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1572468703; b11->expiry = 604800; b11->min_final_cltv_expiry = 10; @@ -622,7 +622,7 @@ int main(int argc, char *argv[]) */ msatoshi = AMOUNT_MSAT(1000000000); b11 = new_bolt11(tmpctx, &msatoshi); - b11->chain = chainparams_for_network("bitcoin"); + b11->chain = chainparams_for_network("palladium"); b11->timestamp = 1496314658; if (!hex_decode("0001020304050607080900010203040506070809000102030405060708090102", strlen("0001020304050607080900010203040506070809000102030405060708090102"), diff --git a/common/test/run-bolt12-encode-test.c b/common/test/run-bolt12-encode-test.c index 5ca641f93..cae099f47 100644 --- a/common/test/run-bolt12-encode-test.c +++ b/common/test/run-bolt12-encode-test.c @@ -169,12 +169,12 @@ int main(int argc, char *argv[]) offer->offer_chains[0] = chainparams_for_network("testnet")->genesis_blockhash; print_valid_offer(offer, "for testnet", "chains[0] is testnet", NULL); - offer->offer_chains[0] = chainparams_for_network("bitcoin")->genesis_blockhash; + offer->offer_chains[0] = chainparams_for_network("palladium")->genesis_blockhash; print_valid_offer(offer, "for bitcoin (redundant)", "chains[0] is bitcoin", NULL); offer->offer_chains = tal_arr(offer, struct bitcoin_blkid, 2); offer->offer_chains[0] = chainparams_for_network("liquid")->genesis_blockhash; - offer->offer_chains[1] = chainparams_for_network("bitcoin")->genesis_blockhash; + offer->offer_chains[1] = chainparams_for_network("palladium")->genesis_blockhash; print_valid_offer(offer, "for bitcoin or liquidv1", "chains[0] is liquidv1, chains[1] is bitcoin", NULL); offer->offer_chains = NULL; diff --git a/common/test/run-psbt_diff.c b/common/test/run-psbt_diff.c index 1c107851a..e21b5f358 100644 --- a/common/test/run-psbt_diff.c +++ b/common/test/run-psbt_diff.c @@ -156,7 +156,7 @@ int main(int argc, const char *argv[]) struct wally_psbt *start, *end; u32 flags = 0; - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); /* Create two psbts! */ end = create_psbt(tmpctx, 1, 1, 0); diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 90975b815..d806060ec 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -418,9 +418,10 @@ class SimpleBitcoinProxy: throwaway connections. This is easier than to reach into the RPC library to close, reopen and reauth upon failure. """ - def __init__(self, btc_conf_file, timeout=TIMEOUT, *args, **kwargs): + def __init__(self, btc_conf_file, timeout=TIMEOUT, wallet_url=None, *args, **kwargs): self.__btc_conf_file__ = btc_conf_file self.__timeout__ = timeout + self.__wallet_url__ = wallet_url def __getattr__(self, name): if name.startswith('__') and name.endswith('__'): @@ -428,8 +429,11 @@ class SimpleBitcoinProxy: raise AttributeError # Create a callable to do the actual call - proxy = BitcoinProxy(btc_conf_file=self.__btc_conf_file__, - timeout=self.__timeout__) + proxy_kwargs = dict(btc_conf_file=self.__btc_conf_file__, + timeout=self.__timeout__) + if self.__wallet_url__: + proxy_kwargs['service_url'] = self.__wallet_url__ + proxy = BitcoinProxy(**proxy_kwargs) def f(*args): logging.debug("Calling {name} with arguments {args}".format( @@ -449,7 +453,7 @@ class SimpleBitcoinProxy: return f -class BitcoinD(TailableProc): +class PalladiumD(TailableProc): def __init__(self, bitcoin_dir="/tmp/palladiumd-test", rpcport=None): TailableProc.__init__(self, bitcoin_dir, verbose=False) @@ -470,7 +474,7 @@ class BitcoinD(TailableProc): os.makedirs(regtestdir) self.cmd_line = [ - 'bitcoind', + 'palladiumd', '-datadir={}'.format(bitcoin_dir), '-printtoconsole', '-server', @@ -490,7 +494,7 @@ class BitcoinD(TailableProc): # For after 0.16.1 (eg. 3f398d7a17f136cd4a67998406ca41a124ae2966), this # needs its own [regtest] section. BITCOIND_REGTEST = {'rpcport': rpcport} - self.conf_file = os.path.join(bitcoin_dir, 'bitcoin.conf') + self.conf_file = os.path.join(bitcoin_dir, 'palladium.conf') write_config(self.conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST) self.rpc = SimpleBitcoinProxy(btc_conf_file=self.conf_file) self.proxies = [] @@ -503,7 +507,7 @@ class BitcoinD(TailableProc): TailableProc.start(self) self.wait_for_log("Done loading", timeout=TIMEOUT) - logging.info("BitcoinD started") + logging.info("PalladiumD started") if wallet_file: self.rpc.restorewallet("lightningd-tests", wallet_file) else: @@ -512,6 +516,25 @@ class BitcoinD(TailableProc): except JSONRPCError: self.rpc.loadwallet("lightningd-tests") + # Re-initialize rpc proxy with the wallet-scoped URL so that + # sendtoaddress, getbalance, etc. use the lightningd-tests wallet. + # Palladiumd's multi-wallet mode requires explicit wallet path. + rpc_url = "http://{}:{}@127.0.0.1:{}/wallet/lightningd-tests".format( + BITCOIND_CONFIG['rpcuser'], + BITCOIND_CONFIG['rpcpassword'], + self.rpcport, + ) + self.rpc = SimpleBitcoinProxy( + btc_conf_file=self.conf_file, + wallet_url=rpc_url, + ) + + # Palladiumd starts in IBD (initialblockdownload=true) even in regtest. + # Generate 122 blocks: Palladium COINBASE_MATURITY=120, so needs 121+ blocks + # to mature the first coinbase reward (plus 1 extra for safety). + addr = self.rpc.getnewaddress() + self.rpc.generatetoaddress(122, addr) + def stop(self): for p in self.proxies: p.stop() @@ -656,14 +679,14 @@ class BitcoinD(TailableProc): self.rpc.submitblock(b) -class ElementsD(BitcoinD): +class ElementsD(PalladiumD): def __init__(self, bitcoin_dir="/tmp/bitcoind-test", rpcport=None): config = BITCOIND_CONFIG.copy() if 'regtest' in config: del config['regtest'] config['chain'] = 'liquid-regtest' - BitcoinD.__init__(self, bitcoin_dir, rpcport) + PalladiumD.__init__(self, bitcoin_dir, rpcport) self.cmd_line = [ 'elementsd', @@ -739,8 +762,8 @@ class LightningD(TailableProc): 'network': TEST_NETWORK, 'ignore-fee-limits': 'false', - 'bitcoin-rpcuser': BITCOIND_CONFIG['rpcuser'], - 'bitcoin-rpcpassword': BITCOIND_CONFIG['rpcpassword'], + 'palladium-rpcuser': BITCOIND_CONFIG['rpcuser'], + 'palladium-rpcpassword': BITCOIND_CONFIG['rpcpassword'], # Make sure we don't touch any existing config files in the user's $HOME 'palladium-datadir': lightning_dir, @@ -771,7 +794,7 @@ class LightningD(TailableProc): f.write(seed) self.opts['dev-fast-gossip'] = None - self.opts['dev-bitcoind-poll'] = 1 + self.opts['dev-palladiumd-poll'] = 1 self.prefix = 'lightningd-%d' % (node_id) # Log to stdout so we see it in failure cases, and log file for TailableProc. self.opts['log-file'] = ['-', os.path.join(lightning_dir, "log")] @@ -806,7 +829,7 @@ class LightningD(TailableProc): return self.cmd_prefix + [self.executable] + self.early_opts + opts def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False): - self.opts['bitcoin-rpcport'] = self.rpcproxy.rpcport + self.opts['palladium-rpcport'] = self.rpcproxy.rpcport TailableProc.start(self, stdin, stdout_redir=False, stderr_redir=stderr_redir) if wait_for_initialized: self.wait_for_log("Server started with public key") @@ -980,7 +1003,7 @@ class LightningNode(object): if dsn is not None: self.daemon.opts['wallet'] = dsn if VALGRIND: - trace_skip_pattern = '*python*,*bitcoin-cli*,*elements-cli*,*cln-grpc*,*clnrest*,*wss-proxy*,*cln-bip353*,*reckless' + trace_skip_pattern = '*python*,*palladium-cli*,*elements-cli*,*cln-grpc*,*clnrest*,*wss-proxy*,*cln-bip353*,*reckless' if not valgrind_plugins: trace_skip_pattern += ',*plugins*' self.daemon.cmd_prefix = [ @@ -1160,12 +1183,12 @@ class LightningNode(object): c.close() db.close() - def is_synced_with_bitcoin(self, info=None): + def is_synced_with_palladium(self, info=None): if info is None: info = self.rpc.getinfo() return 'warning_palladiumd_sync' not in info and 'warning_lightningd_sync' not in info - def start(self, wait_for_bitcoind_sync=True, stderr_redir=False): + def start(self, wait_for_bitcoind_sync=True, wait_for_palladiumd_sync=True, stderr_redir=False): # If we have a disconnect string, dump it to a file for daemon. if 'dev-disconnect' in self.daemon.opts: with open(self.daemon.opts['dev-disconnect'], "w") as f: @@ -1178,8 +1201,8 @@ class LightningNode(object): # This shortcut is sufficient for our simple tests. self.port = self.info['binding'][0]['port'] self.gossip_store.open() # Reopen the gossip_store now that we should have one - if wait_for_bitcoind_sync and not self.is_synced_with_bitcoin(self.info): - wait_for(lambda: self.is_synced_with_bitcoin()) + if (wait_for_bitcoind_sync or wait_for_palladiumd_sync) and not self.is_synced_with_palladium(self.info): + wait_for(lambda: self.is_synced_with_palladium()) def stop(self, timeout=10): """ Attempt to do a clean shutdown, but kill if it hangs diff --git a/lightningd/lightning_gossip_compactd b/lightningd/lightning_gossip_compactd index 4a2754aac5372ad58e65897fb258a9dfd548bcc3..5136ff5522433e44a04df925f791986b48606cb7 100755 GIT binary patch delta 144 zcmcbyCh^9a#0?e9B3)Tm487wg?{)0U{phi7v%$xJmuk&D%q zOg2fgNHT19Sk45*%s|Wn#H>Kf2E^<@%mKulK+FZi+(66&#JoVv2gLk9EC9rUKr95r T!aytn#G*hfw%uX5xWsw@wJbPT delta 144 zcmcbyCh^9a#0?e9A`9=b8tyc3-?L=Cdev_allow_localhost, "Announce and allow announcments for localhost address"); - clnopt_witharg("--dev-bitcoind-poll", OPT_DEV|OPT_SHOWINT, + clnopt_witharg("--dev-palladiumd-poll", OPT_DEV|OPT_SHOWINT, opt_set_u32, opt_show_u32, &ld->topology->poll_seconds, "Time between polling for new transactions"); @@ -1143,7 +1143,7 @@ static char *list_features_and_exit(struct lightningd *ld) static char *opt_lightningd_usage(struct lightningd *ld) { - char *extra = tal_fmt(NULL, "\nA bitcoin lightning daemon (default " + char *extra = tal_fmt(NULL, "\nA palladium lightning daemon (default " "values shown for network: %s).", chainparams->network_name); opt_usage_and_exit(extra); tal_free(extra); diff --git a/plugins/bcli.c b/plugins/bcli.c index 97a2a6276..0391238cc 100644 --- a/plugins/bcli.c +++ b/plugins/bcli.c @@ -732,7 +732,7 @@ static void bitcoind_failure(struct plugin *p, const char *error_message) plugin_err(p, "\n%s\n\n" "Make sure you have palladiumd running and that palladium-cli" " is able to connect to palladiumd.\n\n" - "You can verify that your Bitcoin Core installation is" + "You can verify that your Palladium installation is" " ready for use by running:\n\n" " $ %s 'hello world'\n", error_message, args_string(cmd, cmd, NULL)); @@ -776,16 +776,35 @@ static void parse_getnetworkinfo_result(struct plugin *p, const char *buf) tal_free(result); } +/* Exit code 7 means RPC_IN_WARMUP: palladiumd is starting up but not ready yet */ +#define RPC_IN_WARMUP_EXIT_CODE 7 + static void wait_and_check_bitcoind(struct plugin *p) { struct bcli_result *res; const char **cmd; + int retries = 0; /* Special case: -rpcwait flags go on command line, not stdin */ cmd = gather_args(bitcoind, NULL, "-rpcwait", "getnetworkinfo", NULL); + +retry: res = execute_bitcoin_cli(bitcoind, p, cmd, NULL); + /* palladiumd returns 7 (RPC_IN_WARMUP) while still starting up. + * Keep retrying for up to 60 seconds. */ + if (res->exitstatus == RPC_IN_WARMUP_EXIT_CODE) { + if (retries++ < 60) { + sleep(1); + tal_free(res); + goto retry; + } + bitcoind_failure(p, + "palladiumd still warming up after 60s. " + "Is palladiumd fully started?"); + } + if (res->exitstatus == 1) bitcoind_failure(p, "RPC connection timed out. Could " diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index 698fc4005..7948da55a 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -1,6 +1,6 @@ # NOTE: For detailed documentation, refer to https://docs.corelightning.org/docs/writing-json-schemas. # NOTE: Set the test `TIMEOUT` to greater than 3 seconds to prevent failures caused by waiting on the bitcoind response. -# The `dev-bitcoind-poll` interval is 3 seconds, so a shorter timeout may result in test failures. +# The `dev-palladiumd-poll` interval is 3 seconds, so a shorter timeout may result in test failures. # NOTE: Different nodes are selected to record examples based on data availability, quality, and volume. # For example, node `l1` is used to capture examples for `listsendpays`, whereas node `l2` is utilized for `listforwards`. @@ -450,7 +450,7 @@ def setup_test_nodes(node_factory, bitcoind): 'allow_bad_gossip': True, 'log-level': 'debug', 'broken_log': '.*', - 'dev-bitcoind-poll': 3, # Default 1; increased to avoid rpc failures + 'dev-palladiumd-poll': 3, # Default 1; increased to avoid rpc failures }.copy() for i in range(6) ] @@ -1322,7 +1322,7 @@ def generate_splice_examples(node_factory, bitcoind): 'allow-deprecated-apis': True, 'allow_bad_gossip': True, 'broken_log': '.*', - 'dev-bitcoind-poll': 3, + 'dev-palladiumd-poll': 3, }.copy() for i in range(2) ] @@ -1396,7 +1396,7 @@ def generate_channels_examples(node_factory, bitcoind, l1, l3, l4, l5): 'allow-deprecated-apis': True, 'allow_bad_gossip': True, 'broken_log': '.*', - 'dev-bitcoind-poll': 3, + 'dev-palladiumd-poll': 3, }.copy() for i in range(2) ] @@ -1446,7 +1446,7 @@ def generate_channels_examples(node_factory, bitcoind, l1, l3, l4, l5): 'allow-deprecated-apis': True, 'allow_bad_gossip': True, 'broken_log': '.*', - 'dev-bitcoind-poll': 3, + 'dev-palladiumd-poll': 3, }.copy() for i in range(2) ] diff --git a/tests/fuzz/fuzz-addr.c b/tests/fuzz/fuzz-addr.c index a833bc298..38bce09a5 100644 --- a/tests/fuzz/fuzz-addr.c +++ b/tests/fuzz/fuzz-addr.c @@ -8,7 +8,7 @@ void init(int *argc, char ***argv) { - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); /* Don't call this if we're in unit-test mode, as libfuzz.c does it */ if (!tmpctx) common_setup("fuzzer"); diff --git a/tests/fuzz/fuzz-close_tx.c b/tests/fuzz/fuzz-close_tx.c index d3f3abf98..6d2782a2f 100644 --- a/tests/fuzz/fuzz-close_tx.c +++ b/tests/fuzz/fuzz-close_tx.c @@ -15,7 +15,7 @@ void init(int *argc, char ***argv) /* Don't call this if we're in unit-test mode, as libfuzz.c does it */ if (!tmpctx) common_setup("fuzzer"); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); } void run(const uint8_t *data, size_t size) diff --git a/tests/fuzz/fuzz-full_channel.c b/tests/fuzz/fuzz-full_channel.c index c907f4533..513059a73 100644 --- a/tests/fuzz/fuzz-full_channel.c +++ b/tests/fuzz/fuzz-full_channel.c @@ -240,7 +240,7 @@ void init(int *argc, char ***argv) /* Don't call this if we're in unit-test mode, as libfuzz.c does it */ if (!tmpctx) common_setup("fuzzer"); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); int devnull = open("/dev/null", O_WRONLY); status_setup_sync(devnull); } diff --git a/tests/fuzz/fuzz-handle_onion_message.c b/tests/fuzz/fuzz-handle_onion_message.c index 0bc4b3085..daf525ca8 100644 --- a/tests/fuzz/fuzz-handle_onion_message.c +++ b/tests/fuzz/fuzz-handle_onion_message.c @@ -67,7 +67,7 @@ void init(int *argc, char ***argv) common_setup("fuzzer"); lightningd_fd = open("/dev/null", O_WRONLY); status_setup_sync(lightningd_fd); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); memset(&priv, 'b', sizeof(priv)); memset(&siphashseed, 1, sizeof(siphashseed)); diff --git a/tests/fuzz/fuzz-init_received.c b/tests/fuzz/fuzz-init_received.c index 064ac1455..1946918e3 100644 --- a/tests/fuzz/fuzz-init_received.c +++ b/tests/fuzz/fuzz-init_received.c @@ -121,7 +121,7 @@ static struct io_plan *do_nothing(struct io_conn *conn, void *side) void init(int *argc, char ***argv) { - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); /* Don't call this if we're in unit-test mode, as libfuzz.c does it */ if (!tmpctx) common_setup("fuzzer"); diff --git a/tests/fuzz/fuzz-initial_channel.c b/tests/fuzz/fuzz-initial_channel.c index 52eca85fa..117aa1ba7 100644 --- a/tests/fuzz/fuzz-initial_channel.c +++ b/tests/fuzz/fuzz-initial_channel.c @@ -28,7 +28,7 @@ void init(int *argc, char ***argv) common_setup("fuzzer"); int devnull = open("/dev/null", O_WRONLY); status_setup_sync(devnull); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); } #define MAX_SATS (u64)WALLY_SATOSHI_PER_BTC * WALLY_BTC_MAX diff --git a/tests/fuzz/fuzz-wireaddr.c b/tests/fuzz/fuzz-wireaddr.c index 32d480bae..510434de4 100644 --- a/tests/fuzz/fuzz-wireaddr.c +++ b/tests/fuzz/fuzz-wireaddr.c @@ -14,7 +14,7 @@ void init(int *argc, char ***argv) /* Don't call this if we're in unit-test mode, as libfuzz.c does it */ if (!tmpctx) common_setup("fuzzer"); - chainparams = chainparams_for_network("bitcoin"); + chainparams = chainparams_for_network("palladium"); } void run(const uint8_t *data, size_t size) diff --git a/tests/plugins/badestimate.py b/tests/plugins/badestimate.py index a17467b54..1229d0d19 100755 --- a/tests/plugins/badestimate.py +++ b/tests/plugins/badestimate.py @@ -15,10 +15,10 @@ cli = "bitcoin-cli" if network == "regtest" else "elements-cli" def bcli(plugin, cmd): ret = subprocess.run([cli, - '-datadir={}'.format(plugin.get_option("bitcoin-datadir")), - '-rpcuser={}'.format(plugin.get_option("bitcoin-rpcuser")), - '-rpcpassword={}'.format(plugin.get_option("bitcoin-rpcpassword")), - '-rpcport={}'.format(plugin.get_option("bitcoin-rpcport"))] + '-datadir={}'.format(plugin.get_option("palladium-datadir")), + '-rpcuser={}'.format(plugin.get_option("palladium-rpcuser")), + '-rpcpassword={}'.format(plugin.get_option("palladium-rpcpassword")), + '-rpcport={}'.format(plugin.get_option("palladium-rpcport"))] + cmd, stdout=subprocess.PIPE) if ret.returncode != 0: return None @@ -86,10 +86,10 @@ def getutxout(plugin, txid, vout, *kwargs): "script": txout['scriptPubKey']['hex']} -plugin.add_option("bitcoin-rpcuser", '', '') -plugin.add_option("bitcoin-rpcpassword", '', '') -plugin.add_option("bitcoin-datadir", '', '') -plugin.add_option("bitcoin-rpcport", '', '') +plugin.add_option("palladium-rpcuser", '', '') +plugin.add_option("palladium-rpcpassword", '', '') +plugin.add_option("palladium-datadir", '', '') +plugin.add_option("palladium-rpcport", '', '') plugin.add_option("badestimate-badorder", False, 'Send out-of-order estimates', opt_type='bool') plugin.run() diff --git a/tests/plugins/bitcoin/part1.py b/tests/plugins/bitcoin/part1.py index fdd759cb5..98f9b0220 100755 --- a/tests/plugins/bitcoin/part1.py +++ b/tests/plugins/bitcoin/part1.py @@ -30,9 +30,9 @@ def getchaininfo(plugin, **kwargs): # We don't use these options, but it allows us to get to the expected failure. -plugin.add_option("bitcoin-rpcuser", "", "") -plugin.add_option("bitcoin-rpcpassword", "", "") -plugin.add_option("bitcoin-rpcport", "", "") -plugin.add_option("bitcoin-datadir", "", "") +plugin.add_option("palladium-rpcuser", "", "") +plugin.add_option("palladium-rpcpassword", "", "") +plugin.add_option("palladium-rpcport", "", "") +plugin.add_option("palladium-datadir", "", "") plugin.run() diff --git a/tests/test_db.py b/tests/test_db.py index a18ae2cee..c0e90ab7e 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -468,7 +468,7 @@ def test_db_sanity_checks(bitcoind, node_factory): # Now try wrong network, l1.daemon.opts['wallet'] = "sqlite3://" + l1.db.path - l1.daemon.opts['network'] = "bitcoin" + l1.daemon.opts['network'] = "palladium" l1.daemon.start(wait_for_initialized=False, stderr_redir=True) l1.daemon.wait_for_log(r'\*\*BROKEN\*\* wallet: Wallet blockchain hash does not match network blockchain hash') diff --git a/tests/test_gossip.py b/tests/test_gossip.py index e0b1ed9b0..a4ab25712 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -1789,7 +1789,7 @@ def test_gossip_announce_invalid_block(node_factory, bitcoind): """ # Need to slow down the poll interval so the announcement preceeds the # blockchain catchup, otherwise we won't call `getfilteredblock`. - opts = {'dev-bitcoind-poll': TIMEOUT // 2} + opts = {'dev-palladiumd-poll': TIMEOUT // 2} l1 = node_factory.get_node(options=opts) bitcoind.generate_block(1) @@ -1819,7 +1819,7 @@ def test_gossip_announce_unknown_block(node_factory, bitcoind): """ # Need to slow down the poll interval so the announcement preceeds the # blockchain catchup, otherwise we won't call `getfilteredblock`. - opts = {'dev-bitcoind-poll': TIMEOUT // 2} + opts = {'dev-palladiumd-poll': TIMEOUT // 2} l1 = node_factory.get_node(options=opts) diff --git a/tests/test_misc.py b/tests/test_misc.py index faac4c7a3..820941179 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -2770,7 +2770,7 @@ def test_new_node_is_mainnet(node_factory): l1 = node_factory.get_node(start=False, may_fail=True) basedir = l1.daemon.opts.get("lightning-dir") - netdir = os.path.join(basedir, "bitcoin") + netdir = os.path.join(basedir, "palladium") shutil.rmtree(basedir) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index e19495297..2eb1c3af8 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1928,8 +1928,8 @@ def test_bitcoin_backend(node_factory, bitcoind): del l1.daemon.opts["plugin-dir"] del l1.daemon.opts["disable-plugin"] l1.start() - assert l1.daemon.is_in_log("bitcoin-cli initialized and connected to" - " bitcoind") + assert l1.daemon.is_in_log("palladium-cli initialized and connected to" + " palladiumd") def test_bitcoin_backend_gianttx(node_factory, bitcoind): diff --git a/tests/utils.py b/tests/utils.py index 9fc902aac..af14fe1ee 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -18,7 +18,7 @@ CHANNEL_SIZE = 50000 def default_ln_port(network: str) -> int: network_map = { - "bitcoin": 9735, + "palladium": 9735, "testnet": 19735, "regtest": 19846, "signet": 39735,