Update `DEFAULT_TX_EXPIRY_DELTA` to 40 blocks, as specified in
<https://zips.z.cash/zip-0203#changes-for-blossom>. fixes #837. Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
d37e6adee5
commit
32296e7327
|
@ -571,9 +571,9 @@ mod tests {
|
|||
if available == Amount::zero() && required == Amount::from_u64(12000).unwrap()
|
||||
);
|
||||
|
||||
// Mine blocks SAPLING_ACTIVATION_HEIGHT + 1 to 21 (that don't send us funds)
|
||||
// Mine blocks SAPLING_ACTIVATION_HEIGHT + 1 to 41 (that don't send us funds)
|
||||
// until just before the first transaction expires
|
||||
for i in 1..22 {
|
||||
for i in 1..42 {
|
||||
let (cb, _) = fake_compact_block(
|
||||
sapling_activation_height() + i,
|
||||
cb.hash(),
|
||||
|
@ -605,11 +605,11 @@ mod tests {
|
|||
if available == Amount::zero() && required == Amount::from_u64(12000).unwrap()
|
||||
);
|
||||
|
||||
// Mine block SAPLING_ACTIVATION_HEIGHT + 22 so that the first transaction expires
|
||||
// Mine block SAPLING_ACTIVATION_HEIGHT + 42 so that the first transaction expires
|
||||
let (cb, _) = fake_compact_block(
|
||||
sapling_activation_height() + 22,
|
||||
sapling_activation_height() + 42,
|
||||
cb.hash(),
|
||||
&ExtendedSpendingKey::master(&[22]).to_diversifiable_full_viewing_key(),
|
||||
&ExtendedSpendingKey::master(&[42]).to_diversifiable_full_viewing_key(),
|
||||
AddressType::DefaultExternal,
|
||||
value,
|
||||
);
|
||||
|
@ -716,9 +716,9 @@ mod tests {
|
|||
send_and_recover_with_policy(&mut db_write, OvkPolicy::Sender).unwrap();
|
||||
assert_eq!(&recovered_to, &addr2);
|
||||
|
||||
// Mine blocks SAPLING_ACTIVATION_HEIGHT + 1 to 22 (that don't send us funds)
|
||||
// Mine blocks SAPLING_ACTIVATION_HEIGHT + 1 to 42 (that don't send us funds)
|
||||
// so that the first transaction expires
|
||||
for i in 1..=22 {
|
||||
for i in 1..=42 {
|
||||
let (cb, _) = fake_compact_block(
|
||||
sapling_activation_height() + i,
|
||||
cb.hash(),
|
||||
|
|
|
@ -45,7 +45,9 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
const DEFAULT_TX_EXPIRY_DELTA: u32 = 20;
|
||||
/// Since Blossom activation, the default transaction expiry delta should be 40 blocks.
|
||||
/// <https://zips.z.cash/zip-0203#changes-for-blossom>
|
||||
const DEFAULT_TX_EXPIRY_DELTA: u32 = 40;
|
||||
|
||||
/// Errors that can occur during transaction construction.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
@ -200,7 +202,7 @@ impl<'a, P: consensus::Parameters, R: RngCore + CryptoRng> Builder<'a, P, R> {
|
|||
/// # Default values
|
||||
///
|
||||
/// The expiry height will be set to the given height plus the default transaction
|
||||
/// expiry delta (20 blocks).
|
||||
/// expiry delta.
|
||||
pub fn new_with_rng(params: P, target_height: BlockHeight, rng: R) -> Builder<'a, P, R> {
|
||||
Self::new_internal(params, rng, target_height)
|
||||
}
|
||||
|
@ -525,7 +527,7 @@ mod testing {
|
|||
/// # Default values
|
||||
///
|
||||
/// The expiry height will be set to the given height plus the default transaction
|
||||
/// expiry delta (20 blocks).
|
||||
/// expiry delta.
|
||||
///
|
||||
/// WARNING: DO NOT USE IN PRODUCTION
|
||||
pub fn test_only_new_with_rng(params: P, height: BlockHeight, rng: R) -> Builder<'a, P, R> {
|
||||
|
|
Loading…
Reference in New Issue