Move bitcoin-serai to core-json and feature-gate the RPC functionality

This commit is contained in:
Luke Parker
2025-11-10 04:24:07 -05:00
parent e65a37e639
commit 06a4824aba
6 changed files with 101 additions and 55 deletions

View File

@@ -14,9 +14,9 @@ pub(crate) async fn rpc() -> Rpc {
// If this node has already been interacted with, clear its chain
if rpc.get_latest_block_number().await.unwrap() > 0 {
rpc
.rpc_call(
.call(
"invalidateblock",
serde_json::json!([hex::encode(rpc.get_block_hash(1).await.unwrap())]),
&format!(r#"["{}"]"#, hex::encode(rpc.get_block_hash(1).await.unwrap())),
)
.await
.unwrap()

View File

@@ -41,21 +41,21 @@ async fn send_and_get_output(rpc: &Rpc, scanner: &Scanner, key: ProjectivePoint)
let block_number = rpc.get_latest_block_number().await.unwrap() + 1;
rpc
.rpc_call::<Vec<String>>(
.call::<Vec<String>>(
"generatetoaddress",
serde_json::json!([
1,
&format!(
r#"[1, "{}"]"#,
Address::from_script(&p2tr_script_buf(key).unwrap(), Network::Regtest).unwrap()
]),
),
)
.await
.unwrap();
// Mine until maturity
rpc
.rpc_call::<Vec<String>>(
.call::<Vec<String>>(
"generatetoaddress",
serde_json::json!([100, Address::p2sh(Script::new(), Network::Regtest).unwrap()]),
&format!(r#"[100, "{}"]"#, Address::p2sh(Script::new(), Network::Regtest).unwrap()),
)
.await
.unwrap();