Improve check_merkle_tree_sorted
to work with preimages of arbitrary length
#104
Labels
enhancement
New feature or request
Currently, the
call_check_merkle_tree_sorted
function puts a limit on the length of the preimages in the Merkle tree that is checking; #90 increased it to 162, but Merkle trees used in PSBTs can have much longer elements (over 4kb for taproot control blocks defined in BIP-341, but potentially unlimited for future extensions or PSBT vendor-specific fields).call_check_merkle_tree_sorted
is currently keeping two consecutive elements at the time (in order to check the correct ordering), but memory limitations prevent from using this approach for larger preimages.Ideally, we would like to stream each byte sequence only once, and still be able to detect which one is larger.
That's impossible in theory, but it's likely possible in most cases, and that might be good enough in practice.
The text was updated successfully, but these errors were encountered: