We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f7fc0e commit c596cdbCopy full SHA for c596cdb
src/util/taproot.rs
@@ -131,6 +131,21 @@ impl TapLeafHash {
131
}
132
133
134
+impl TapBranchHash {
135
+ /// Computes branch hash given two hashes of the nodes underneath it.
136
+ pub fn from_node_hashes(a: sha256::Hash, b: sha256::Hash) -> TapBranchHash {
137
+ let mut eng = TapBranchHash::engine();
138
+ if a < b {
139
+ eng.input(&a);
140
+ eng.input(&b);
141
+ } else {
142
143
144
+ };
145
+ TapBranchHash::from_engine(eng)
146
+ }
147
+}
148
+
149
/// Maximum depth of a taproot tree script spend path.
150
// https://github.com/bitcoin/bitcoin/blob/e826b22da252e0599c61d21c98ff89f366b3120f/src/script/interpreter.h#L229
151
pub const TAPROOT_CONTROL_MAX_NODE_COUNT: usize = 128;
0 commit comments