fix rust beta panic string warnings (#1731)
This commit is contained in:
parent
a4d8b16213
commit
21dbf5cb69
|
@ -74,9 +74,7 @@ impl ZcashDeserialize for SproutShieldedAddress {
|
||||||
let network = match version_bytes {
|
let network = match version_bytes {
|
||||||
magics::MAINNET => Network::Mainnet,
|
magics::MAINNET => Network::Mainnet,
|
||||||
magics::TESTNET => Network::Testnet,
|
magics::TESTNET => Network::Testnet,
|
||||||
_ => panic!(SerializationError::Parse(
|
_ => panic!("SerializationError: bad sprout shielded addr version/type"),
|
||||||
"bad sprout shielded addr version/type",
|
|
||||||
)),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(SproutShieldedAddress {
|
Ok(SproutShieldedAddress {
|
||||||
|
|
|
@ -89,9 +89,7 @@ impl ZcashDeserialize for SpendingKey {
|
||||||
let network = match version_bytes {
|
let network = match version_bytes {
|
||||||
sk_magics::MAINNET => Network::Mainnet,
|
sk_magics::MAINNET => Network::Mainnet,
|
||||||
sk_magics::TESTNET => Network::Testnet,
|
sk_magics::TESTNET => Network::Testnet,
|
||||||
_ => panic!(SerializationError::Parse(
|
_ => panic!("SerializationError: bad sprout spending key version/type"),
|
||||||
"bad sprout spending key version/type",
|
|
||||||
)),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(SpendingKey {
|
Ok(SpendingKey {
|
||||||
|
@ -277,9 +275,7 @@ impl ZcashDeserialize for IncomingViewingKey {
|
||||||
let network = match version_bytes {
|
let network = match version_bytes {
|
||||||
ivk_magics::MAINNET => Network::Mainnet,
|
ivk_magics::MAINNET => Network::Mainnet,
|
||||||
ivk_magics::TESTNET => Network::Testnet,
|
ivk_magics::TESTNET => Network::Testnet,
|
||||||
_ => panic!(SerializationError::Parse(
|
_ => panic!("SerializationError: bad sprout incoming viewing key network"),
|
||||||
"bad sprout incoming viewing key network",
|
|
||||||
)),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(IncomingViewingKey {
|
Ok(IncomingViewingKey {
|
||||||
|
|
|
@ -364,16 +364,15 @@ impl ExpandedDifficulty {
|
||||||
// This assertion also makes sure that size fits in its 8 bit compact field
|
// This assertion also makes sure that size fits in its 8 bit compact field
|
||||||
assert!(
|
assert!(
|
||||||
size < (31 + OFFSET) as _,
|
size < (31 + OFFSET) as _,
|
||||||
format!(
|
"256^size (256^{}) must fit in a u256, after the sign bit adjustment and offset",
|
||||||
"256^size (256^{}) must fit in a u256, after the sign bit adjustment and offset",
|
size
|
||||||
size
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
let size = u32::try_from(size).expect("a 0-6 bit value fits in a u32");
|
let size = u32::try_from(size).expect("a 0-6 bit value fits in a u32");
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
mantissa <= UNSIGNED_MANTISSA_MASK.into(),
|
mantissa <= UNSIGNED_MANTISSA_MASK.into(),
|
||||||
format!("mantissa {:x?} must fit in its compact field", mantissa)
|
"mantissa {:x?} must fit in its compact field",
|
||||||
|
mantissa
|
||||||
);
|
);
|
||||||
let mantissa = u32::try_from(mantissa).expect("a 0-23 bit value fits in a u32");
|
let mantissa = u32::try_from(mantissa).expect("a 0-23 bit value fits in a u32");
|
||||||
|
|
||||||
|
|
|
@ -151,10 +151,10 @@ fn test_block_locator_heights() {
|
||||||
"locators must end with the specified final height"
|
"locators must end with the specified final height"
|
||||||
);
|
);
|
||||||
assert!(height - final_height.0 <= constants::MAX_BLOCK_REORG_HEIGHT,
|
assert!(height - final_height.0 <= constants::MAX_BLOCK_REORG_HEIGHT,
|
||||||
format!("locator for {} must not be more than the maximum reorg height {} below the tip, but {} is {} blocks below the tip",
|
"locator for {} must not be more than the maximum reorg height {} below the tip, but {} is {} blocks below the tip",
|
||||||
height,
|
height,
|
||||||
constants::MAX_BLOCK_REORG_HEIGHT,
|
constants::MAX_BLOCK_REORG_HEIGHT,
|
||||||
final_height.0,
|
final_height.0,
|
||||||
height - final_height.0));
|
height - final_height.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue