Skip to content

PSBT serde implementation#497

Merged
apoelstra merged 3 commits intorust-bitcoin:masterfrom
BP-WG:pending/psbt-serde
Oct 14, 2020
Merged

PSBT serde implementation#497
apoelstra merged 3 commits intorust-bitcoin:masterfrom
BP-WG:pending/psbt-serde

Conversation

@dr-orlovsky
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should drop the spaces here which might make parsing easier in some contexts (e.g. shell ... though of course shell will also barf on the | ;))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo again

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unit test which tries to round-trip every variant as a string?

@dr-orlovsky
Copy link
Copy Markdown
Collaborator Author

@apoelstra fixed typo + tests

type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.replace(' ', "").to_ascii_uppercase().as_ref() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this being case-insensitive or space-insensitive. It will break roundtripping tests for this type or anything that contains it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack 8e0b992

@apoelstra apoelstra merged commit 65b52cf into rust-bitcoin:master Oct 14, 2020
@stevenroose
Copy link
Copy Markdown
Collaborator

I made this work with JSON and added a test here: #508.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants