Skip to content

Commit fae4e8f

Browse files
authored
Merge branch 'master' into output_recursive
2 parents f8f1cee + afe27e3 commit fae4e8f

File tree

12 files changed

+67
-20
lines changed

12 files changed

+67
-20
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ axum-server = "0.5.0"
2525
base64 = "0.22.0"
2626
bip322 = "0.0.8"
2727
bip39 = "2.0.0"
28-
bitcoin = { version = "=0.32.3", features = ["rand"] }
28+
bitcoin = { version = "0.32.5", features = ["rand"] }
2929
bitcoincore-rpc = "0.19.0"
3030
boilerplate = { version = "1.0.0", features = ["axum"] }
3131
brotli = "7.0.0"

crates/mockcore/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/ordinals/ord"
99

1010
[dependencies]
1111
base64 = "0.22.0"
12-
bitcoin = { version = "0.32.3", features = ["serde", "rand"] }
12+
bitcoin = { version = "0.32.5", features = ["serde", "rand"] }
1313
hex = "0.4.3"
1414
jsonrpc-core = "18.0.0"
1515
jsonrpc-derive = "18.0.0"

crates/mockcore/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,10 @@ impl Handle {
346346
pub fn network(&self) -> String {
347347
match self.state().network {
348348
Network::Bitcoin => "mainnet".to_string(),
349-
Network::Testnet => Network::Testnet.to_string(),
350-
Network::Signet => Network::Signet.to_string(),
351349
Network::Regtest => Network::Regtest.to_string(),
350+
Network::Signet => Network::Signet.to_string(),
351+
Network::Testnet4 => Network::Testnet4.to_string(),
352+
Network::Testnet => Network::Testnet.to_string(),
352353
_ => panic!(),
353354
}
354355
}

crates/ordinals/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "CC0-1.0"
99
rust-version = "1.74.0"
1010

1111
[dependencies]
12-
bitcoin = { version = "=0.32.3", features = ["rand"] }
12+
bitcoin = { version = "0.32.5", features = ["rand"] }
1313
derive_more = { version = "1.0.0", features = ["display", "from_str"] }
1414
serde = { version = "1.0.137", features = ["derive"] }
1515
serde_with = "3.7.0"

crates/ordinals/src/sat_point.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Encodable for SatPoint {
4444
}
4545

4646
impl Decodable for SatPoint {
47-
fn consensus_decode<D: bitcoin::io::Read + bitcoin::io::BufRead + ?Sized>(
47+
fn consensus_decode<D: bitcoin::io::Read + ?Sized>(
4848
d: &mut D,
4949
) -> Result<Self, bitcoin::consensus::encode::Error> {
5050
Ok(SatPoint {

deploy/setup

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ case $CHAIN in
5353
CSP_ORIGIN=signet.ordinals.com
5454
ufw allow 38333
5555
;;
56-
test)
56+
testnet3)
5757
COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3
5858
CSP_ORIGIN=testnet.ordinals.com
5959
ufw allow 18333
6060
;;
61+
testnet4)
62+
COOKIE_FILE_DIR=/var/lib/bitcoind/testnet4
63+
CSP_ORIGIN=testnet4.ordinals.com
64+
ufw allow 48333
65+
;;
6166
*)
6267
echo "Unknown chain: $CHAIN"
6368
exit 1

justfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ deploy-signet branch='master' remote='ordinals/ord': \
5050
(deploy branch remote 'signet' 'signet.ordinals.net')
5151

5252
deploy-testnet branch='master' remote='ordinals/ord': \
53-
(deploy branch remote 'test' 'testnet.ordinals.net')
53+
(deploy branch remote 'testnet3' 'testnet.ordinals.net')
54+
55+
deploy-testnet4 branch='master' remote='ordinals/ord': \
56+
(deploy branch remote 'testnet4' 'testnet4.ordinals.net')
5457

5558
deploy-all: \
5659
deploy-testnet \
60+
deploy-testnet4 \
5761
deploy-signet \
5862
deploy-mainnet-alpha \
5963
deploy-mainnet-bravo \
@@ -66,7 +70,7 @@ delete-indices: \
6670
delete-index domain:
6771
ssh root@{{domain}} 'systemctl stop ord && rm -f /var/lib/ord/*/index.redb'
6872

69-
servers := 'alpha bravo charlie signet testnet'
73+
servers := 'alpha bravo charlie signet testnet3 testnet4'
7074

7175
initialize-server-keys:
7276
#!/usr/bin/env bash

src/chain.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ pub enum Chain {
66
#[default]
77
#[value(alias("main"))]
88
Mainnet,
9+
Regtest,
10+
Signet,
911
#[value(alias("test"))]
1012
Testnet,
11-
Signet,
12-
Regtest,
13+
Testnet4,
1314
}
1415

1516
impl Chain {
@@ -23,13 +24,14 @@ impl Chain {
2324
Self::Regtest => 18443,
2425
Self::Signet => 38332,
2526
Self::Testnet => 18332,
27+
Self::Testnet4 => 48332,
2628
}
2729
}
2830

2931
pub(crate) fn inscription_content_size_limit(self) -> Option<usize> {
3032
match self {
3133
Self::Mainnet | Self::Regtest => None,
32-
Self::Testnet | Self::Signet => Some(1024),
34+
Self::Testnet | Self::Testnet4 | Self::Signet => Some(1024),
3335
}
3436
}
3537

@@ -39,6 +41,7 @@ impl Chain {
3941
Self::Regtest => 0,
4042
Self::Signet => 112402,
4143
Self::Testnet => 2413343,
44+
Self::Testnet4 => 0,
4245
}
4346
}
4447

@@ -52,6 +55,7 @@ impl Chain {
5255
Self::Regtest => 110,
5356
Self::Signet => 175392,
5457
Self::Testnet => 2544192,
58+
Self::Testnet4 => 0,
5559
}
5660
}
5761

@@ -73,9 +77,10 @@ impl Chain {
7377
pub(crate) fn join_with_data_dir(self, data_dir: impl AsRef<Path>) -> PathBuf {
7478
match self {
7579
Self::Mainnet => data_dir.as_ref().to_owned(),
76-
Self::Testnet => data_dir.as_ref().join("testnet3"),
77-
Self::Signet => data_dir.as_ref().join("signet"),
7880
Self::Regtest => data_dir.as_ref().join("regtest"),
81+
Self::Signet => data_dir.as_ref().join("signet"),
82+
Self::Testnet => data_dir.as_ref().join("testnet3"),
83+
Self::Testnet4 => data_dir.as_ref().join("testnet4"),
7984
}
8085
}
8186
}
@@ -84,9 +89,10 @@ impl From<Chain> for Network {
8489
fn from(chain: Chain) -> Network {
8590
match chain {
8691
Chain::Mainnet => Network::Bitcoin,
87-
Chain::Testnet => Network::Testnet,
88-
Chain::Signet => Network::Signet,
8992
Chain::Regtest => Network::Regtest,
93+
Chain::Signet => Network::Signet,
94+
Chain::Testnet => Network::Testnet,
95+
Chain::Testnet4 => Network::Testnet4,
9096
}
9197
}
9298
}
@@ -101,6 +107,7 @@ impl Display for Chain {
101107
Self::Regtest => "regtest",
102108
Self::Signet => "signet",
103109
Self::Testnet => "testnet",
110+
Self::Testnet4 => "testnet4",
104111
}
105112
)
106113
}
@@ -115,6 +122,7 @@ impl FromStr for Chain {
115122
"regtest" => Ok(Self::Regtest),
116123
"signet" => Ok(Self::Signet),
117124
"testnet" => Ok(Self::Testnet),
125+
"testnet4" => Ok(Self::Testnet4),
118126
_ => Err(SnafuError::InvalidChain {
119127
chain: s.to_string(),
120128
}),
@@ -132,6 +140,7 @@ mod tests {
132140
assert_eq!("regtest".parse::<Chain>().unwrap(), Chain::Regtest);
133141
assert_eq!("signet".parse::<Chain>().unwrap(), Chain::Signet);
134142
assert_eq!("testnet".parse::<Chain>().unwrap(), Chain::Testnet);
143+
assert_eq!("testnet4".parse::<Chain>().unwrap(), Chain::Testnet4);
135144
assert_eq!(
136145
"foo".parse::<Chain>().unwrap_err().to_string(),
137146
"Invalid chain `foo`"

src/options.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::*;
44
#[command(group(
55
ArgGroup::new("chains")
66
.required(false)
7-
.args(&["chain_argument", "signet", "regtest", "testnet"]),
7+
.args(&["chain_argument", "signet", "regtest", "testnet", "testnet4"]),
88
))]
99
pub struct Options {
1010
#[arg(long, help = "Load Bitcoin Core data dir from <BITCOIN_DATA_DIR>.")]
@@ -82,4 +82,6 @@ pub struct Options {
8282
pub(crate) signet: bool,
8383
#[arg(long, short, help = "Use testnet. Equivalent to `--chain testnet`.")]
8484
pub(crate) testnet: bool,
85+
#[arg(long, help = "Use testnet4. Equivalent to `--chain testnet4`.")]
86+
pub(crate) testnet4: bool,
8587
}

src/settings.rs

+26-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ impl Settings {
156156
.then_some(Chain::Signet)
157157
.or(options.regtest.then_some(Chain::Regtest))
158158
.or(options.testnet.then_some(Chain::Testnet))
159+
.or(options.testnet4.then_some(Chain::Testnet4))
159160
.or(options.chain_argument),
160161
commit_interval: options.commit_interval,
161162
config: options.config,
@@ -431,9 +432,10 @@ impl Settings {
431432
Ok(blockchain_info) => {
432433
break match blockchain_info.chain.to_string().as_str() {
433434
"bitcoin" => Chain::Mainnet,
434-
"testnet" => Chain::Testnet,
435435
"regtest" => Chain::Regtest,
436436
"signet" => Chain::Signet,
437+
"testnet" => Chain::Testnet,
438+
"testnet4" => Chain::Testnet4,
437439
other => bail!("Bitcoin RPC server on unknown chain: {other}"),
438440
}
439441
}
@@ -760,6 +762,20 @@ mod tests {
760762
} else {
761763
"/Bitcoin/signet/.cookie"
762764
}));
765+
766+
let cookie_file = parse(&["--testnet4"])
767+
.cookie_file()
768+
.unwrap()
769+
.display()
770+
.to_string();
771+
772+
assert!(cookie_file.ends_with(if cfg!(target_os = "linux") {
773+
"/.bitcoin/testnet4/.cookie"
774+
} else if cfg!(windows) {
775+
r"\Bitcoin\testnet4\.cookie"
776+
} else {
777+
"/Bitcoin/testnet4/.cookie"
778+
}));
763779
}
764780

765781
#[test]
@@ -817,6 +833,7 @@ mod tests {
817833

818834
#[test]
819835
fn network_accepts_aliases() {
836+
#[track_caller]
820837
fn check_network_alias(alias: &str, suffix: &str) {
821838
let data_dir = parse(&["--chain", alias]).data_dir().display().to_string();
822839

@@ -857,6 +874,14 @@ mod tests {
857874
"ord/testnet3"
858875
},
859876
);
877+
check_network_alias(
878+
"testnet4",
879+
if cfg!(windows) {
880+
r"ord\testnet4"
881+
} else {
882+
"ord/testnet4"
883+
},
884+
);
860885
}
861886

862887
#[test]

src/subcommand/wallet/inscriptions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) fn run(wallet: Wallet) -> SubcommandResult {
1414
Chain::Regtest => "http://localhost/inscription/",
1515
Chain::Signet => "https://signet.ordinals.com/inscription/",
1616
Chain::Testnet => "https://testnet.ordinals.com/inscription/",
17+
Chain::Testnet4 => "https://testnet4.ordinals.com/inscription/",
1718
};
1819

1920
let mut output = Vec::new();

0 commit comments

Comments
 (0)