merkle: Make MerkleNode.collect return a set of nodes instead of a dict
Previously the MerkleNode.collect method was returning a dict whose keys are node types and values dict of {<node_hash>: <node_data>}.
In order to give more flexibility to client code for the processing of collected nodes, prefer to simply return a set of MerkleNode.
As a consequence, MerkleNode objects need to be hashable by Python so add a new abstract method hash_to_int for converting hash value to integer that derived classes must implement.
Closes #4633 (closed)
Migrated from D8686 (view on Phabricator)