HomePhabricator

[ecash-herald] Cleaner OP_RETURN parsing

Description

[ecash-herald] Cleaner OP_RETURN parsing

Summary:
Some OP_RETURN txs of unknown schema are printed to the channel in an unintelligible way. Many times, assuming an unknown OP_RETURN is ascii can make it readable (existing test vector for unknown tx is like this).

Other times, decoding a random non-ascii hex string as ascii creates jargon.

Add a function containsOnlyPrintableAscii to determine if a given OP_RETURN hex string contains only non-control ascii characters. If a given OP_RETURN stack array does not, print each push as a hex value.

Test Plan: npm test

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14381

Details

Provenance
bytesofmanAuthored on Aug 16 2023, 22:46
bytesofmanPushed on Aug 21 2023, 18:08
Reviewer
Restricted Project
Differential Revision
D14381: [ecash-herald] Cleaner OP_RETURN parsing
Parents
rABCaa109b915fb4: psbt: Assert that tx has a value in UpdatePSBTOutput
Branches
Unknown
Tags
Unknown