Page MenuHomePhabricator

Stop parsing the radix tree if the callback function returns false
ClosedPublic

Authored by Fabien on May 13 2022, 14:22.

Details

Summary

This diff lets the callsite decide to continue or stop the tree traversal at each leaf. Returning true continue the loop, and returning false stops it.

Test Plan
ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
radix_tree_parse_early_exit
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19018
Build 37792: Build Difflint-circular-dependencies · build-debug · build-without-wallet · build-clang-tidy · build-clang · build-diff
Build 37791: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.May 13 2022, 14:22
Fabien planned changes to this revision.May 13 2022, 14:30

Also return the completion status to the callsite

deadalnix added a subscriber: deadalnix.

This is good, I left a few comments on ways the code could be improved upon.

src/radix.h
258 ↗(On Diff #33505)

This is getting fairly nested, you should probably swap the conditions around.

262 ↗(On Diff #33505)

I find the ternary here to be quite confusing.

This revision is now accepted and ready to land.May 13 2022, 20:46

Revert the ternary, and invert the conditions to gain 1 level of nesting