@@ -5,9 +5,6 @@ const buffer_1 = require('buffer');
55const bcrypto = require ( '../crypto' ) ;
66const bufferutils_1 = require ( '../bufferutils' ) ;
77const types_1 = require ( '../types' ) ;
8- const TAP_LEAF_TAG = 'TapLeaf' ;
9- const TAP_BRANCH_TAG = 'TapBranch' ;
10- const TAP_TWEAK_TAG = 'TapTweak' ;
118exports . LEAF_VERSION_TAPSCRIPT = 0xc0 ;
129function rootHashFromPath ( controlBlock , tapleafMsg ) {
1310 const k = [ tapleafMsg ] ;
@@ -70,7 +67,7 @@ exports.findScriptPath = findScriptPath;
7067function tapleafHash ( leaf ) {
7168 const version = leaf . version || exports . LEAF_VERSION_TAPSCRIPT ;
7269 return bcrypto . taggedHash (
73- TAP_LEAF_TAG ,
70+ 'TapLeaf' ,
7471 buffer_1 . Buffer . concat ( [
7572 buffer_1 . Buffer . from ( [ version ] ) ,
7673 serializeScript ( leaf . output ) ,
@@ -80,13 +77,13 @@ function tapleafHash(leaf) {
8077exports . tapleafHash = tapleafHash ;
8178function tapTweakHash ( pubKey , h ) {
8279 return bcrypto . taggedHash (
83- TAP_TWEAK_TAG ,
80+ 'TapTweak' ,
8481 buffer_1 . Buffer . concat ( h ? [ pubKey , h ] : [ pubKey ] ) ,
8582 ) ;
8683}
8784exports . tapTweakHash = tapTweakHash ;
8885function tapBranchHash ( a , b ) {
89- return bcrypto . taggedHash ( TAP_BRANCH_TAG , buffer_1 . Buffer . concat ( [ a , b ] ) ) ;
86+ return bcrypto . taggedHash ( 'TapBranch' , buffer_1 . Buffer . concat ( [ a , b ] ) ) ;
9087}
9188function serializeScript ( s ) {
9289 const varintLen = bufferutils_1 . varuint . encodingLength ( s . length ) ;
0 commit comments