private Map<Bytes32, Bytes> collectTrieNodesToBeRequestedAfterRoot(
      final ForestWorldStateKeyValueStorage storage, final Bytes32 rootHash, final int maxNodes) {
    final Map<Bytes32, Bytes> trieNodes = new HashMap<>();

    TrieNodeDecoder.breadthFirstDecoder((location, hash) -> storage.getNodeData(hash), rootHash)
        .filter(n -> !Objects.equals(n.getHash(), rootHash))
        .filter(Node::isReferencedByHash)
        .limit(maxNodes)
        .forEach((n) -> trieNodes.put(n.getHash(), n.getEncodedBytes()));

    return trieNodes;
  }
Walks through trie represented by the given rootHash and returns hash-node pairs that would
need to be requested from the network in order to reconstruct this trie, excluding the root
node.

@param storage Storage holding node data required to reconstitute the trie represented by
    rootHash
@param rootHash The hash of the root node of some trie
@param maxNodes The maximum number of values to collect before returning
@return A list of hash-node pairs
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/FastWorldStateDownloaderTest.java