HomePhabricator

Make descriptor test deterministic

Description

Make descriptor test deterministic

Summary:

Changed MaybeUseHInsteadOfApostrophy to UseHInsteadOfApostrophe.
This function now always replaces apostrophes with 'h'.
The original Check function was renamed to DoCheck and it's
called with an additional parameter which tells it to either
leave the prv and pub arguments as is or replace the apostrophes
with 'h'. The test runs with apostrophes replaced in prv only,
pub only, prv and pub and without replacement at all. Replacement
of apostrophes in a descriptor and then running DoCheck is conditional
on whether apostrophes are found in that descriptor.

Additionally, instead of dropping the checksum recalculate it
after replacing apostrophes with 'h' in the function
UseHInsteadOfApostrophe
using the GetDescriptorChecksum function. That way, this also
introduces an indirect unit test to GetDescriptoChecksum.

Backport of core PR16570.

Test Plan:

ninja check

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
David Reikher <david.reikher@gmail.com>Authored on Aug 18 2020, 11:36
FabienCommitted on Aug 18 2020, 11:41
abc-botPushed on Aug 18 2020, 11:41
Reviewer
Restricted Project
Differential Revision
D7208: Make descriptor test deterministic
Parents
rABC6d2a0ff05ad9: Fix a typo in a comment
Branches
Unknown
Tags
Unknown