HomePhabricator

Merge #11293: Deduplicate CMerkleBlock construction code, add test coverage

Description

Merge #11293: Deduplicate CMerkleBlock construction code, add test coverage

Summary:
46ce223d1 Add tests for CMerkleBlock usage with txids specified (James O'Beirne)

Pull request description:

What started as a simple task to add test coverage ended up giving way to a light refactoring. This consolidates the mostly-identical `CMerkleBlock` constructors into one (using C++11 constructor delegation) and adds coverage for the by-txids construction case.

### Before

![selection_006](https://user-images.githubusercontent.com/73197/30242104-0f381fe4-9545-11e7-9617-83b87fce0456.png)

### After

![selection_008](https://user-images.githubusercontent.com/73197/30242107-1425dfaa-9545-11e7-9e6b-2c3432517dd1.png)

Tree-SHA512: eed84ed3e8bfc43473077b575c8252759a857e37275e4b36ca7cc2c17a65895e5f494bfd9d4aeab09fc6e98fc6a9c641ac7ecc0ddbeefe01a9e4308e7909e529

Changes made in D3371 conflict with the original PR; the constructor has been updated to the form it would take if D3371 would have been implemented after this refactoring. This private constructor is more strict than the original one (the original could be called with either, both, or neither of the filter and txids parameters).

Partial backport of Core PR11293
https://github.com/bitcoin/bitcoin/pull/11293/

Also includes left over changes to PR12920
https://github.com/bitcoin/bitcoin/pull/12920/

Test Plan:

make check
ninja check

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc, nakihito

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc, nakihito

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Dec 2 2019, 21:56
Mark Lundeberg <36528214+markblundeberg@users.noreply.github.com>Committed on Dec 3 2019, 22:54
deadalnixPushed on Dec 4 2019, 17:59
Reviewer
Restricted Owners Package
Differential Revision
D3689: Merge #11293: Deduplicate CMerkleBlock construction code, add test coverage
Parents
rSTAGINGed3b45c4b998: Fix -Wunused-const-variable in descriptor_tests.cpp
Branches
Unknown
Tags
Unknown