@@ -29,6 +29,10 @@ function toUtxoPsbt(psbt: Psbt | Buffer | Uint8Array) {
2929 throw new Error ( "Invalid input" ) ;
3030}
3131
32+ function assertEqualBuffer ( a : Buffer | Uint8Array , b : Buffer | Uint8Array , message ?: string ) {
33+ assert . strictEqual ( Buffer . from ( a ) . toString ( "hex" ) , Buffer . from ( b ) . toString ( "hex" ) , message ) ;
34+ }
35+
3236const fixtures = getPsbtFixtures ( rootWalletKeys ) ;
3337
3438function describeUpdateInputWithDescriptor (
@@ -52,15 +56,15 @@ function describeUpdateInputWithDescriptor(
5256 const updatedPsbt = toUtxoPsbt ( wrappedPsbt ) ;
5357 updatedPsbt . signAllInputsHD ( rootWalletKeys . triple [ 0 ] ) ;
5458 updatedPsbt . signAllInputsHD ( rootWalletKeys . triple [ 2 ] ) ;
59+ const wrappedSignedPsbt = toWrappedPsbt ( updatedPsbt ) ;
5560 updatedPsbt . finalizeAllInputs ( ) ;
56- assert . deepStrictEqual (
57- fullSignedFixture . psbt
58- . clone ( )
59- . finalizeAllInputs ( )
60- . extractTransaction ( )
61- . toBuffer ( )
62- . toString ( "hex" ) ,
63- updatedPsbt . extractTransaction ( ) . toBuffer ( ) . toString ( "hex" ) ,
61+ wrappedSignedPsbt . finalize ( ) ;
62+
63+ assertEqualBuffer ( updatedPsbt . toBuffer ( ) , wrappedSignedPsbt . serialize ( ) ) ;
64+
65+ assertEqualBuffer (
66+ fullSignedFixture . psbt . clone ( ) . finalizeAllInputs ( ) . extractTransaction ( ) . toBuffer ( ) ,
67+ updatedPsbt . extractTransaction ( ) . toBuffer ( ) ,
6468 ) ;
6569 } ) ;
6670 } ) ;
@@ -77,11 +81,11 @@ fixtures.forEach(({ psbt, scriptType, stage }) => {
7781 } ) ;
7882
7983 it ( "should map to same hex" , function ( ) {
80- assert . strictEqual ( buf . toString ( "hex" ) , Buffer . from ( wrappedPsbt . serialize ( ) ) . toString ( "hex" ) ) ;
84+ assertEqualBuffer ( buf , wrappedPsbt . serialize ( ) ) ;
8185 } ) ;
8286
8387 it ( "should round-trip utxolib -> ms -> utxolib" , function ( ) {
84- assert . strictEqual ( buf . toString ( "hex" ) , toUtxoPsbt ( wrappedPsbt ) . toBuffer ( ) . toString ( "hex" ) ) ;
88+ assertEqualBuffer ( buf , toUtxoPsbt ( wrappedPsbt ) . toBuffer ( ) ) ;
8589 } ) ;
8690
8791 if ( stage === "bare" ) {
0 commit comments