HomePhabricator

Let the radix tree work with 256 bits keys

Description

Let the radix tree work with 256 bits keys

Summary:
The radix tree is relying on several features that prevent it from using an arbitrary key type:

  • The key of type K is expected to return the correct size via a call to sizeof(K)
  • It should implement several operators for the RadixNode::get() to work, including a cast to size_t so it can be used as an array index.

The radix tree is expected to be used wtih uint256 type keys, for both ProofId and TxId. The uint256 type behaves correctly with sizeof() but still need to be able to perform the arithmetic and cast operations. This diff implements a key wrapper class that implements the required methods that make it possible to work with uint256 as a key type.

Test Plan:

ninja check

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Subscribers: deadalnix, sdulfari

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

Details

Provenance
FabienAuthored on May 9 2022, 16:42
FabienPushed on May 11 2022, 08:07
Reviewer
Restricted Project
Differential Revision
D11405: Let the radix tree work with 256 bits keys
Parents
rABC7a7d4d19ede1: [avalanche] Remove dead code in the delegation tests
Branches
Unknown
Tags
Unknown