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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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