bitcoinjs-lib
bitcoinjs-lib copied to clipboard
[Taproot] Add an utility for sorting leafs in order of weight (likelihood of use)
trafficstars
It should not be required to sort in any sort of order, but we should offer some sort of helper function to help out.
Input:
- an ordered list of scripts with weights attached
Output
- a binary tree were the weights of the script are correlated with the length of the
path from the tree root to that script leaf
Hi @motorina0, I’m interested in working on this issue. Is anyone else already working on it? If not, can I take it? Do you have any suggestions or tips on how to approach it?
Bticoinops' Schnorr taproot workshop has a notebook on using Huffman constructor to achieve this.
- such functionality would be useful, but I'm not sure it should be part of this lib
- if you create an utility we can point to it in the readme
- such functionality would be useful, but I'm not sure it should be part of this lib
@motorina0 What did you have in mind for this issue? The huffman constructor does what I think this issue is requesting for.