function getTrieForBlockHash(blockHash) {
const nodes = [];
const links = [];
let nodeHashByNodeId = {};
const accounts = getAccountsOnBlockHash(blockHash);
for (const node of accountsTreeSchema.nodes) {
let hash = node.indices.reduce(
(hash, ind) => hash + ind + (accounts[ind] || "_"),
""
);
nodeHashByNodeId[node.id] = hash;
nodes.push({
id: hash,
blockHash,
nodeId: node.id,
group: COLOR_SCHEMA.DEFAULT,
runtime: 1,
name: hash,
label: "A"
});
}
for (const link of accountsTreeSchema.links) {
links.push({
source: nodeHashByNodeId[link[0]],
target: nodeHashByNodeId[link[1]],
type: ""
});
}
return { nodes, links };
}