Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Jul 17, 2023
1 parent 5b2e41b commit d32f62f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/templates/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ use super::*;
#[derive(Boilerplate)]
pub(crate) struct BlockHtml {
hash: BlockHash,
target: BlockHash,
target: bitcoin::pow::Target,
best_height: Height,
block: Block,
height: Height,
}

impl BlockHtml {
pub(crate) fn new(block: Block, height: Height, best_height: Height) -> Self {
let mut target = block.header.target().to_be_bytes();
target.reverse();
Self {
hash: block.header.block_hash(),
target: BlockHash::from_inner(target),
target: block.header.target(),
block,
height,
best_height,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod tests {
chain: Chain::Mainnet,
output: TxOut {
value: 3,
script_pubkey: Script::new_p2pkh(&PubkeyHash::all_zeros()),
script_pubkey: ScriptBuf::new_p2pkh(&PubkeyHash::all_zeros()),
},
}
.to_string(),
Expand Down
6 changes: 3 additions & 3 deletions src/templates/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ impl PageContent for TransactionHtml {
mod tests {
use {
super::*,
bitcoin::{blockdata::script, PackedLockTime, TxOut},
bitcoin::{blockdata::script, locktime::absolute::LockTime, TxOut},
};

#[test]
fn html() {
let transaction = Transaction {
version: 0,
lock_time: PackedLockTime(0),
lock_time: LockTime::ZERO,
input: vec![TxIn {
sequence: Default::default(),
previous_output: Default::default(),
Expand Down Expand Up @@ -104,7 +104,7 @@ mod tests {
fn with_blockhash() {
let transaction = Transaction {
version: 0,
lock_time: PackedLockTime(0),
lock_time: LockTime::ZERO,
input: Vec::new(),
output: vec![
TxOut {
Expand Down
2 changes: 1 addition & 1 deletion templates/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>Input /{{self.path.0}}/{{self.path.1}}/{{self.path.2}}</h1>
<dt>witness</dt><dd class=monospace>{{hex::encode(consensus::serialize(&self.input.witness))}}</dd>
%% }
%% if !self.input.script_sig.is_empty() {
<dt>script sig</dt><dd class=monospace>{{self.input.script_sig.asm()}}</dd>
<dt>script sig</dt><dd class=monospace>{{self.input.script_sig.to_asm_string()}}</dd>
<dt>text</dt><dd>{{String::from_utf8_lossy(self.input.script_sig.as_bytes())}}</dd>
%% }
</dl>
2 changes: 1 addition & 1 deletion templates/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>Output <span class=monospace>{{self.outpoint}}</span></h1>
</dd>
%% }
<dt>value</dt><dd>{{ self.output.value }}</dd>
<dt>script pubkey</dt><dd class=monospace>{{ self.output.script_pubkey.asm() }}</dd>
<dt>script pubkey</dt><dd class=monospace>{{ self.output.script_pubkey.to_asm_string() }}</dd>
%% if let Ok(address) = self.chain.address_from_script(&self.output.script_pubkey ) {
<dt>address</dt><dd class=monospace>{{ address }}</dd>
%% }
Expand Down
2 changes: 1 addition & 1 deletion templates/transaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h2>{{"Output".tally(self.transaction.output.len())}}</h2>
</a>
<dl>
<dt>value</dt><dd>{{ output.value }}</dd>
<dt>script pubkey</dt><dd class=monospace>{{ output.script_pubkey.asm() }}</dd>
<dt>script pubkey</dt><dd class=monospace>{{ output.script_pubkey.to_asm_string() }}</dd>
%% if let Ok(address) = self.chain.address_from_script(&output.script_pubkey) {
<dt>address</dt><dd class=monospace>{{ address }}</dd>
%% }
Expand Down

0 comments on commit d32f62f

Please sign in to comment.