Page MenuHomePhabricator

[Chronik] Add `TokenTxEntry::burn_summary` for a nice human-readable burn summary
ClosedPublic

Authored by tobias_ruck on Jan 5 2024, 21:00.

Details

Summary

SLP/ALP txs can have problems for many reasons, so we add burn_summary, which returns a human-readable string of exactly what went wrong.

Test Plan

cargo test -p bitcoinsuite-slp --lib test_burn_summary

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Only style nits

chronik/bitcoinsuite-slp/src/burn_summary.rs
16–20 ↗(On Diff #43954)

Style suggestion, I leave that up to you

25–33 ↗(On Diff #43954)

Style nit: could be a single return statement

31 ↗(On Diff #43954)

Style nit: could be a single if

106 ↗(On Diff #43954)
This revision is now accepted and ready to land.Jan 8 2024, 10:13
chronik/bitcoinsuite-slp/src/burn_summary.rs
16–20 ↗(On Diff #43954)

this looks like Python, not Rust; there's no ternary operator in Rust (not even a Pythonesque one)

25–33 ↗(On Diff #43954)

I'll see how this formats

31 ↗(On Diff #43954)

I think it's more readable this way; I could also just make it a big predicate

106 ↗(On Diff #43954)

Actually this would create an Unexpected burn: ; expected X... message