Details
- Reviewers
Fabien - Group Reviewers
Restricted Project - Commits
- rABCe3f7047dbbd4: [Chronik] Add `slp::parse`, with support for SLP GENESIS txs
cargo test -p bitcoinsuite-slp
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
| chronik/bitcoinsuite-slp/src/slp/error.rs | ||
|---|---|---|
| 143 ↗ | (On Diff #43683) | And wherever this should go, a more meaningful name would be: unknown_protocol or something like that. Or maybe consider moving this logic a layer up where we would have some fn converting Result<ParsedData, ParseError> -> SomeEnum where SomeEnum would be something like ValidToken(ParsedData) | InvalidToken(ParseError) | UnknownProtocol. I don't have a clear picture yet. |
change signature of parse and parse_tx to Result<Option<ParsedData>, ParseError>.
this parallels D15016.
added MintField to simplify the mint_baton_out_idx vs. mint_vault_scripthash handling code
| chronik/bitcoinsuite-slp/src/slp/error.rs | ||
|---|---|---|
| 117 ↗ | (On Diff #43698) | This could actually be a slightly different error and simplify the code a bit: UnexpectedPushNumber with expected and actual that throws when expected != actual (and not only when actual < expected). Doing so removes the need for another check for SuperfluousPushes. |
| chronik/bitcoinsuite-slp/src/slp/genesis.rs | ||
| 35 ↗ | (On Diff #43698) | Here: little value to check < and > as 2 different conditions since you know the exact number of push you expect, could be just: if opreturn_data.len() != 10 {
return Err(ParseError::UnexpectedPushNumber {
expected: 10,
actual: opreturn_data.len(),
});
} |
| 63 ↗ | (On Diff #43698) | We discussed the opportunity to make this an enum instead, which looks like a good improvement |
| chronik/bitcoinsuite-slp/src/slp/parse.rs | ||
| 82 ↗ | (On Diff #43698) | great |
| 149 ↗ | (On Diff #43698) | Nit: add this is reflected in the spec from the bcash repo |
| chronik/bitcoinsuite-slp/tests/test_slp_parse_genesis.rs | ||
|---|---|---|
| 338 ↗ | (On Diff #43702) | good catch |