Impl `zcash_protocol::consensus::Parameters`

This commit is contained in:
Marek 2024-04-22 20:22:07 +02:00
parent 3084f3bb69
commit ba6c0d7110
3 changed files with 18 additions and 2 deletions

View File

@ -5898,6 +5898,7 @@ dependencies = [
"zcash_history",
"zcash_note_encryption",
"zcash_primitives",
"zcash_protocol",
"zebra-test",
]

View File

@ -98,6 +98,8 @@ zcash_encoding = "0.2.0"
zcash_history = "0.4.0"
zcash_note_encryption = "0.4.0"
zcash_primitives = { version = "0.13.0-rc.1", features = ["transparent-inputs"] }
zcash_protocol = { version = "0.1.1" }
zcash_address = { version = "0.3.2" }
# Time
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std", "serde"] }
@ -131,8 +133,6 @@ serde_json = { version = "1.0.115", optional = true }
# Production feature async-error and testing feature proptest-impl
tokio = { version = "1.37.0", optional = true }
zcash_address = { version = "0.3.2" }
# Experimental feature shielded-scan
zcash_client_backend = { version = "0.10.0-rc.1", optional = true }

View File

@ -339,3 +339,18 @@ impl zcash_primitives::consensus::Parameters for Network {
self.kind().b58_script_address_prefix()
}
}
impl zcash_protocol::consensus::Parameters for Network {
fn network_type(&self) -> zcash_address::Network {
self.kind().into()
}
fn activation_height(
&self,
nu: zcash_protocol::consensus::NetworkUpgrade,
) -> Option<zcash_protocol::consensus::BlockHeight> {
NetworkUpgrade::from(nu)
.activation_height(self)
.map(|Height(h)| zcash_protocol::consensus::BlockHeight::from_u32(h))
}
}