Re-name Timestamp to BlockTime
We just added a `Timestamp` type without knowing that there was a push by OpenTimestamps to also create a timestamp and that our new type may lead to confusion. Our timestamp is explicitly for the `time` field in a block so we can call it `BlockTime`. This name change makes the module name stale but we will change that in a following patch to ease review.
This commit is contained in:
parent
1a18ff582c
commit
e2dee4900f
|
@ -413,7 +413,7 @@ mod test {
|
||||||
use crate::merkle_tree::TxMerkleNode;
|
use crate::merkle_tree::TxMerkleNode;
|
||||||
use crate::transaction::OutPointExt;
|
use crate::transaction::OutPointExt;
|
||||||
use crate::{
|
use crate::{
|
||||||
transaction, Amount, BlockChecked, CompactTarget, OutPoint, ScriptBuf, Sequence, Timestamp,
|
transaction, Amount, BlockChecked, CompactTarget, OutPoint, ScriptBuf, Sequence, BlockTime,
|
||||||
TxIn, TxOut, Txid, Witness,
|
TxIn, TxOut, Txid, Witness,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ mod test {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::from_byte_array([0x99; 32]),
|
prev_blockhash: BlockHash::from_byte_array([0x99; 32]),
|
||||||
merkle_root: TxMerkleNode::from_byte_array([0x77; 32]),
|
merkle_root: TxMerkleNode::from_byte_array([0x77; 32]),
|
||||||
time: Timestamp::from_u32(2),
|
time: BlockTime::from_u32(2),
|
||||||
bits: CompactTarget::from_consensus(3),
|
bits: CompactTarget::from_consensus(3),
|
||||||
nonce: 4,
|
nonce: 4,
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ use core::fmt;
|
||||||
use hashes::{sha256d, HashEngine};
|
use hashes::{sha256d, HashEngine};
|
||||||
use internals::{compact_size, ToU64};
|
use internals::{compact_size, ToU64};
|
||||||
use io::{BufRead, Write};
|
use io::{BufRead, Write};
|
||||||
use units::Timestamp;
|
use units::BlockTime;
|
||||||
|
|
||||||
use super::Weight;
|
use super::Weight;
|
||||||
use crate::consensus::encode::WriteExt as _;
|
use crate::consensus::encode::WriteExt as _;
|
||||||
|
@ -86,15 +86,15 @@ impl Decodable for Version {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Encodable for Timestamp {
|
impl Encodable for BlockTime {
|
||||||
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||||
self.to_u32().consensus_encode(w)
|
self.to_u32().consensus_encode(w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decodable for Timestamp {
|
impl Decodable for BlockTime {
|
||||||
fn consensus_decode<R: BufRead + ?Sized>(r: &mut R) -> Result<Self, encode::Error> {
|
fn consensus_decode<R: BufRead + ?Sized>(r: &mut R) -> Result<Self, encode::Error> {
|
||||||
Decodable::consensus_decode(r).map(Timestamp::from_u32)
|
Decodable::consensus_decode(r).map(BlockTime::from_u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ mod tests {
|
||||||
block::compute_merkle_root(&transactions).unwrap()
|
block::compute_merkle_root(&transactions).unwrap()
|
||||||
);
|
);
|
||||||
assert_eq!(serialize(&real_decode.header().merkle_root), merkle);
|
assert_eq!(serialize(&real_decode.header().merkle_root), merkle);
|
||||||
assert_eq!(real_decode.header().time, Timestamp::from_u32(1231965655));
|
assert_eq!(real_decode.header().time, BlockTime::from_u32(1231965655));
|
||||||
assert_eq!(real_decode.header().bits, CompactTarget::from_consensus(486604799));
|
assert_eq!(real_decode.header().bits, CompactTarget::from_consensus(486604799));
|
||||||
assert_eq!(real_decode.header().nonce, 2067413810);
|
assert_eq!(real_decode.header().nonce, 2067413810);
|
||||||
assert_eq!(real_decode.header().work(), work);
|
assert_eq!(real_decode.header().work(), work);
|
||||||
|
@ -660,7 +660,7 @@ mod tests {
|
||||||
real_decode.header().merkle_root,
|
real_decode.header().merkle_root,
|
||||||
block::compute_merkle_root(&transactions).unwrap()
|
block::compute_merkle_root(&transactions).unwrap()
|
||||||
);
|
);
|
||||||
assert_eq!(real_decode.header().time, Timestamp::from_u32(1472004949));
|
assert_eq!(real_decode.header().time, BlockTime::from_u32(1472004949));
|
||||||
assert_eq!(real_decode.header().bits, CompactTarget::from_consensus(0x1a06d450));
|
assert_eq!(real_decode.header().bits, CompactTarget::from_consensus(0x1a06d450));
|
||||||
assert_eq!(real_decode.header().nonce, 1879759182);
|
assert_eq!(real_decode.header().nonce, 1879759182);
|
||||||
assert_eq!(real_decode.header().work(), work);
|
assert_eq!(real_decode.header().work(), work);
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::opcodes::all::*;
|
||||||
use crate::pow::CompactTarget;
|
use crate::pow::CompactTarget;
|
||||||
use crate::transaction::{self, OutPoint, Transaction, TxIn, TxOut};
|
use crate::transaction::{self, OutPoint, Transaction, TxIn, TxOut};
|
||||||
use crate::witness::Witness;
|
use crate::witness::Witness;
|
||||||
use crate::{script, Amount, BlockHash, Sequence, TestnetVersion, Timestamp};
|
use crate::{script, Amount, BlockHash, Sequence, TestnetVersion, BlockTime};
|
||||||
|
|
||||||
/// How many seconds between blocks we expect on average.
|
/// How many seconds between blocks we expect on average.
|
||||||
pub const TARGET_BLOCK_SPACING: u32 = 600;
|
pub const TARGET_BLOCK_SPACING: u32 = 600;
|
||||||
|
@ -132,7 +132,7 @@ pub fn genesis_block(params: impl AsRef<Params>) -> Block<Checked> {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
||||||
merkle_root,
|
merkle_root,
|
||||||
time: Timestamp::from_u32(1231006505),
|
time: BlockTime::from_u32(1231006505),
|
||||||
bits: CompactTarget::from_consensus(0x1d00ffff),
|
bits: CompactTarget::from_consensus(0x1d00ffff),
|
||||||
nonce: 2083236893,
|
nonce: 2083236893,
|
||||||
},
|
},
|
||||||
|
@ -144,7 +144,7 @@ pub fn genesis_block(params: impl AsRef<Params>) -> Block<Checked> {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
||||||
merkle_root,
|
merkle_root,
|
||||||
time: Timestamp::from_u32(1296688602),
|
time: BlockTime::from_u32(1296688602),
|
||||||
bits: CompactTarget::from_consensus(0x1d00ffff),
|
bits: CompactTarget::from_consensus(0x1d00ffff),
|
||||||
nonce: 414098458,
|
nonce: 414098458,
|
||||||
},
|
},
|
||||||
|
@ -156,7 +156,7 @@ pub fn genesis_block(params: impl AsRef<Params>) -> Block<Checked> {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
||||||
merkle_root,
|
merkle_root,
|
||||||
time: Timestamp::from_u32(1714777860),
|
time: BlockTime::from_u32(1714777860),
|
||||||
bits: CompactTarget::from_consensus(0x1d00ffff),
|
bits: CompactTarget::from_consensus(0x1d00ffff),
|
||||||
nonce: 393743547,
|
nonce: 393743547,
|
||||||
},
|
},
|
||||||
|
@ -168,7 +168,7 @@ pub fn genesis_block(params: impl AsRef<Params>) -> Block<Checked> {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
||||||
merkle_root,
|
merkle_root,
|
||||||
time: Timestamp::from_u32(1598918400),
|
time: BlockTime::from_u32(1598918400),
|
||||||
bits: CompactTarget::from_consensus(0x1e0377ae),
|
bits: CompactTarget::from_consensus(0x1e0377ae),
|
||||||
nonce: 52613770,
|
nonce: 52613770,
|
||||||
},
|
},
|
||||||
|
@ -180,7 +180,7 @@ pub fn genesis_block(params: impl AsRef<Params>) -> Block<Checked> {
|
||||||
version: block::Version::ONE,
|
version: block::Version::ONE,
|
||||||
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
prev_blockhash: BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
|
||||||
merkle_root,
|
merkle_root,
|
||||||
time: Timestamp::from_u32(1296688602),
|
time: BlockTime::from_u32(1296688602),
|
||||||
bits: CompactTarget::from_consensus(0x207fffff),
|
bits: CompactTarget::from_consensus(0x207fffff),
|
||||||
nonce: 2,
|
nonce: 2,
|
||||||
},
|
},
|
||||||
|
@ -320,7 +320,7 @@ mod test {
|
||||||
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(gen.header().time, Timestamp::from_u32(1231006505));
|
assert_eq!(gen.header().time, BlockTime::from_u32(1231006505));
|
||||||
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1d00ffff));
|
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1d00ffff));
|
||||||
assert_eq!(gen.header().nonce, 2083236893);
|
assert_eq!(gen.header().nonce, 2083236893);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -338,7 +338,7 @@ mod test {
|
||||||
gen.header().merkle_root.to_string(),
|
gen.header().merkle_root.to_string(),
|
||||||
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
||||||
);
|
);
|
||||||
assert_eq!(gen.header().time, Timestamp::from_u32(1296688602));
|
assert_eq!(gen.header().time, BlockTime::from_u32(1296688602));
|
||||||
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1d00ffff));
|
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1d00ffff));
|
||||||
assert_eq!(gen.header().nonce, 414098458);
|
assert_eq!(gen.header().nonce, 414098458);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -356,7 +356,7 @@ mod test {
|
||||||
gen.header().merkle_root.to_string(),
|
gen.header().merkle_root.to_string(),
|
||||||
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
|
||||||
);
|
);
|
||||||
assert_eq!(gen.header().time, Timestamp::from_u32(1598918400));
|
assert_eq!(gen.header().time, BlockTime::from_u32(1598918400));
|
||||||
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1e0377ae));
|
assert_eq!(gen.header().bits, CompactTarget::from_consensus(0x1e0377ae));
|
||||||
assert_eq!(gen.header().nonce, 52613770);
|
assert_eq!(gen.header().nonce, 52613770);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -135,7 +135,7 @@ pub use units::{
|
||||||
amount::{Amount, Denomination, SignedAmount},
|
amount::{Amount, Denomination, SignedAmount},
|
||||||
block::{BlockHeight, BlockInterval},
|
block::{BlockHeight, BlockInterval},
|
||||||
fee_rate::FeeRate,
|
fee_rate::FeeRate,
|
||||||
timestamp::{self, Timestamp},
|
timestamp::{self, BlockTime},
|
||||||
weight::Weight,
|
weight::Weight,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1078,7 +1078,7 @@ pub mod test_utils {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::pow::test_utils::{u128_to_work, u32_to_target, u64_to_target};
|
use crate::pow::test_utils::{u128_to_work, u32_to_target, u64_to_target};
|
||||||
use crate::Timestamp;
|
use crate::BlockTime;
|
||||||
|
|
||||||
impl U256 {
|
impl U256 {
|
||||||
fn bit_at(&self, index: usize) -> bool {
|
fn bit_at(&self, index: usize) -> bool {
|
||||||
|
@ -1763,7 +1763,7 @@ mod tests {
|
||||||
version: Version::ONE,
|
version: Version::ONE,
|
||||||
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
||||||
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
||||||
time: Timestamp::from_u32(1599332177),
|
time: BlockTime::from_u32(1599332177),
|
||||||
bits: epoch_start.bits,
|
bits: epoch_start.bits,
|
||||||
nonce: epoch_start.nonce,
|
nonce: epoch_start.nonce,
|
||||||
};
|
};
|
||||||
|
@ -1785,7 +1785,7 @@ mod tests {
|
||||||
version: Version::ONE,
|
version: Version::ONE,
|
||||||
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
||||||
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
||||||
time: Timestamp::from_u32(1599332844),
|
time: BlockTime::from_u32(1599332844),
|
||||||
bits: starting_bits,
|
bits: starting_bits,
|
||||||
nonce: 0,
|
nonce: 0,
|
||||||
};
|
};
|
||||||
|
@ -1795,7 +1795,7 @@ mod tests {
|
||||||
version: Version::ONE,
|
version: Version::ONE,
|
||||||
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
prev_blockhash: BlockHash::from_byte_array([0; 32]),
|
||||||
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
merkle_root: TxMerkleNode::from_byte_array([0; 32]),
|
||||||
time: Timestamp::from_u32(1600591200),
|
time: BlockTime::from_u32(1600591200),
|
||||||
bits: starting_bits,
|
bits: starting_bits,
|
||||||
nonce: 0,
|
nonce: 0,
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ use core::marker::PhantomData;
|
||||||
#[cfg(feature = "arbitrary")]
|
#[cfg(feature = "arbitrary")]
|
||||||
use arbitrary::{Arbitrary, Unstructured};
|
use arbitrary::{Arbitrary, Unstructured};
|
||||||
use hashes::{sha256d, HashEngine as _};
|
use hashes::{sha256d, HashEngine as _};
|
||||||
use units::Timestamp;
|
use units::BlockTime;
|
||||||
|
|
||||||
use crate::merkle_tree::TxMerkleNode;
|
use crate::merkle_tree::TxMerkleNode;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
|
@ -180,7 +180,7 @@ pub struct Header {
|
||||||
/// The root hash of the Merkle tree of transactions in the block.
|
/// The root hash of the Merkle tree of transactions in the block.
|
||||||
pub merkle_root: TxMerkleNode,
|
pub merkle_root: TxMerkleNode,
|
||||||
/// The timestamp of the block, as claimed by the miner.
|
/// The timestamp of the block, as claimed by the miner.
|
||||||
pub time: Timestamp,
|
pub time: BlockTime,
|
||||||
/// The target value below which the blockhash must lie.
|
/// The target value below which the blockhash must lie.
|
||||||
pub bits: CompactTarget,
|
pub bits: CompactTarget,
|
||||||
/// The nonce, selected to obtain a low enough blockhash.
|
/// The nonce, selected to obtain a low enough blockhash.
|
||||||
|
@ -402,7 +402,7 @@ mod tests {
|
||||||
version: Version::ONE,
|
version: Version::ONE,
|
||||||
prev_blockhash: BlockHash::from_byte_array([0x99; 32]),
|
prev_blockhash: BlockHash::from_byte_array([0x99; 32]),
|
||||||
merkle_root: TxMerkleNode::from_byte_array([0x77; 32]),
|
merkle_root: TxMerkleNode::from_byte_array([0x77; 32]),
|
||||||
time: Timestamp::from(2),
|
time: BlockTime::from(2),
|
||||||
bits: CompactTarget::from_consensus(3),
|
bits: CompactTarget::from_consensus(3),
|
||||||
nonce: 4,
|
nonce: 4,
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,7 +58,7 @@ pub use units::{
|
||||||
amount::{self, Amount, SignedAmount},
|
amount::{self, Amount, SignedAmount},
|
||||||
block::{BlockHeight, BlockInterval},
|
block::{BlockHeight, BlockInterval},
|
||||||
fee_rate::{self, FeeRate},
|
fee_rate::{self, FeeRate},
|
||||||
timestamp::{self, Timestamp},
|
timestamp::{self, BlockTime},
|
||||||
weight::{self, Weight},
|
weight::{self, Weight},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,6 @@ pub use self::{
|
||||||
amount::{Amount, SignedAmount},
|
amount::{Amount, SignedAmount},
|
||||||
block::{BlockHeight, BlockInterval},
|
block::{BlockHeight, BlockInterval},
|
||||||
fee_rate::FeeRate,
|
fee_rate::FeeRate,
|
||||||
timestamp::Timestamp,
|
timestamp::BlockTime,
|
||||||
weight::Weight
|
weight::Weight
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,33 +26,33 @@ use serde::{Deserialize, Serialize};
|
||||||
/// ref: <https://en.bitcoin.it/wiki/Block_timestamp>
|
/// ref: <https://en.bitcoin.it/wiki/Block_timestamp>
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct Timestamp(u32);
|
pub struct BlockTime(u32);
|
||||||
|
|
||||||
impl Timestamp {
|
impl BlockTime {
|
||||||
/// Constructs a new [`Timestamp`] from an unsigned 32 bit integer value.
|
/// Constructs a new [`BlockTime`] from an unsigned 32 bit integer value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_u32(t: u32) -> Self { Timestamp(t) }
|
pub const fn from_u32(t: u32) -> Self { BlockTime(t) }
|
||||||
|
|
||||||
/// Returns the inner `u32` value.
|
/// Returns the inner `u32` value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_u32(self) -> u32 { self.0 }
|
pub const fn to_u32(self) -> u32 { self.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u32> for Timestamp {
|
impl From<u32> for BlockTime {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(t: u32) -> Self { Self::from_u32(t) }
|
fn from(t: u32) -> Self { Self::from_u32(t) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Timestamp> for u32 {
|
impl From<BlockTime> for u32 {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(t: Timestamp) -> Self { t.to_u32() }
|
fn from(t: BlockTime) -> Self { t.to_u32() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "arbitrary")]
|
#[cfg(feature = "arbitrary")]
|
||||||
impl<'a> Arbitrary<'a> for Timestamp {
|
impl<'a> Arbitrary<'a> for BlockTime {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
|
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
|
||||||
let t: u32 = u.arbitrary()?;
|
let t: u32 = u.arbitrary()?;
|
||||||
Ok(Timestamp::from(t))
|
Ok(BlockTime::from(t))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use arbitrary::{Arbitrary, Unstructured};
|
||||||
use bitcoin_units::locktime::{absolute, relative}; // Typical usage is `absolute::Height`.
|
use bitcoin_units::locktime::{absolute, relative}; // Typical usage is `absolute::Height`.
|
||||||
use bitcoin_units::{
|
use bitcoin_units::{
|
||||||
amount, block, fee_rate, locktime, parse, weight, Amount, BlockHeight, BlockInterval, FeeRate,
|
amount, block, fee_rate, locktime, parse, weight, Amount, BlockHeight, BlockInterval, FeeRate,
|
||||||
SignedAmount, Timestamp, Weight,
|
SignedAmount, BlockTime, Weight,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A struct that includes all public non-error enums.
|
/// A struct that includes all public non-error enums.
|
||||||
|
@ -42,7 +42,7 @@ struct Structs {
|
||||||
i: relative::Height,
|
i: relative::Height,
|
||||||
j: relative::Time,
|
j: relative::Time,
|
||||||
k: Weight,
|
k: Weight,
|
||||||
l: Timestamp,
|
l: BlockTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Structs {
|
impl Structs {
|
||||||
|
@ -59,7 +59,7 @@ impl Structs {
|
||||||
i: relative::Height::MAX,
|
i: relative::Height::MAX,
|
||||||
j: relative::Time::MAX,
|
j: relative::Time::MAX,
|
||||||
k: Weight::MAX,
|
k: Weight::MAX,
|
||||||
l: Timestamp::from_u32(u32::MAX),
|
l: BlockTime::from_u32(u32::MAX),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ struct CommonTraits {
|
||||||
i: relative::Height,
|
i: relative::Height,
|
||||||
j: relative::Time,
|
j: relative::Time,
|
||||||
k: Weight,
|
k: Weight,
|
||||||
l: Timestamp,
|
l: BlockTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A struct that includes all types that implement `Default`.
|
/// A struct that includes all types that implement `Default`.
|
||||||
|
@ -147,7 +147,7 @@ fn api_can_use_modules_from_crate_root() {
|
||||||
#[test]
|
#[test]
|
||||||
fn api_can_use_types_from_crate_root() {
|
fn api_can_use_types_from_crate_root() {
|
||||||
use bitcoin_units::{
|
use bitcoin_units::{
|
||||||
Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Timestamp, Weight,
|
Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, BlockTime, Weight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ fn api_can_use_all_types_from_module_parse() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn api_can_use_all_types_from_module_timestamp() {
|
fn api_can_use_all_types_from_module_timestamp() {
|
||||||
use bitcoin_units::timestamp::Timestamp;
|
use bitcoin_units::timestamp::BlockTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -295,7 +295,7 @@ impl<'a> Arbitrary<'a> for Structs {
|
||||||
i: relative::Height::arbitrary(u)?,
|
i: relative::Height::arbitrary(u)?,
|
||||||
j: relative::Time::arbitrary(u)?,
|
j: relative::Time::arbitrary(u)?,
|
||||||
k: Weight::arbitrary(u)?,
|
k: Weight::arbitrary(u)?,
|
||||||
l: Timestamp::arbitrary(u)?,
|
l: BlockTime::arbitrary(u)?,
|
||||||
};
|
};
|
||||||
Ok(a)
|
Ok(a)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue