block: Block,
height: Height,
best_height: Height,
inscriptions: Vec<InscriptionId>,
) -> Self {
Self {
hash: block.header.block_hash(),
target: target_as_block_hash(block.header.target()),
height: height.0,
best_height: best_height.0,
inscriptions,
}
}
}
impl PageContent for BlockHtml {
fn title(&self) -> String {
format!("Block {}", self.height)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn html() {
assert_regex_match!(
BlockHtml::new(
Chain::Mainnet.genesis_block(),
Height(0),
Height(0),
0,
Vec::new()
),
"
<h1>Block 0</h1>
<dl>
<dt>hash</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>target</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>timestamp</dt><dd><time>2009-01-03 18:15:05 UTC</time></dd>
<dt>size</dt><dd>285</dd>
<dt>weight</dt><dd>1140</dd>
</dl>
.*
prev
next