Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show output size on output page #590

Merged
merged 1 commit into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,9 @@ mod tests {
"/output/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0",
StatusCode::OK,
".*<title>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</title>.*<h1>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</h1>
<dl>
<dt>size</dt><dd>5000000000</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
<li><a href=/range/0/5000000000 class=mythic>\\[0,5000000000\\)</a></li>
Expand Down
3 changes: 3 additions & 0 deletions src/subcommand/server/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ mod tests {
.to_string(),
"
<h1>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</h1>
<dl>
<dt>size</dt><dd>2</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
<li><a href=/range/0/1 class=mythic>[0,1)</a></li>
Expand Down
3 changes: 3 additions & 0 deletions templates/output.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<h1>Output {{self.outpoint}}</h1>
%% match &self.list {
%% List::Unspent(ranges) => {
<dl>
<dt>size</dt><dd>{{ranges.iter().map(|(start, end)| end - start).sum::<u64>()}}</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
%% for (start, end) in ranges {
Expand Down