feat: improve access to genesis utxos (#302)
This commit is contained in:
parent
d9abd01395
commit
f82fbcd7d9
2 changed files with 9 additions and 19 deletions
|
|
@ -277,10 +277,10 @@ impl From<AddressPayload> for ByronAddress {
|
||||||
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct ByronAddress {
|
pub struct ByronAddress {
|
||||||
#[n(0)]
|
#[n(0)]
|
||||||
payload: TagWrap<ByteVec, 24>,
|
pub payload: TagWrap<ByteVec, 24>,
|
||||||
|
|
||||||
#[n(1)]
|
#[n(1)]
|
||||||
crc: u32,
|
pub crc: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
const CRC: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
|
const CRC: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
|
||||||
|
|
@ -343,11 +343,6 @@ mod tests {
|
||||||
"Ae2tdPwUPEZLs4HtbuNey7tK4hTKrwNwYtGqp7bDfCy2WdR3P6735W5Yfpe",
|
"Ae2tdPwUPEZLs4HtbuNey7tK4hTKrwNwYtGqp7bDfCy2WdR3P6735W5Yfpe",
|
||||||
];
|
];
|
||||||
|
|
||||||
// const ROOT_HASH: &str = "7e9ee4a9527dea9091e2d580edd6716888c42f75d96276290f98fe0b";
|
|
||||||
|
|
||||||
//const NON_AVVM_BYRON_ADDRESS_FROM_PREVIEW_GENESIS =
|
|
||||||
// "FHnt4NL7yPXjpZtYj1YUiX9QYYUZGXDT9gA2PJXQFkTSMx3EgawXK5BUrCHdhe2";
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn roundtrip_base58() {
|
fn roundtrip_base58() {
|
||||||
for vector in TEST_VECTORS {
|
for vector in TEST_VECTORS {
|
||||||
|
|
@ -376,16 +371,4 @@ mod tests {
|
||||||
assert_eq!(crc2, addr.crc);
|
assert_eq!(crc2, addr.crc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn address_id_matches() {
|
|
||||||
// let addr = ByronAddress::from_base58(TEST_VECTOR).unwrap();
|
|
||||||
|
|
||||||
// let payload = addr.decode().unwrap();
|
|
||||||
// let computed =
|
|
||||||
// AddressPayload::hash_address_id(&payload.addrtype, spending_data,
|
|
||||||
// &payload.attributes);
|
|
||||||
|
|
||||||
// assert_eq!(payload.root.to_string(), ROOT_HASH);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,13 @@ pub fn genesis_non_avvm_utxos(config: &GenesisFile) -> Vec<GenesisUtxo> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn genesis_utxos(config: &GenesisFile) -> Vec<GenesisUtxo> {
|
||||||
|
let avvm = genesis_avvm_utxos(config);
|
||||||
|
let non_avvm = genesis_non_avvm_utxos(config);
|
||||||
|
|
||||||
|
[avvm, non_avvm].concat().to_vec()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue