1919 */
2020
2121import * as bitcoin from 'bitcoinjs-lib' ;
22- < < < << << HEAD
2322import * as secp256k1 from 'tiny-secp256k1' ;
24- === === =
25- > >>> >>> feat / multisig - escrow
2623import type { ChainAdapter } from './interface' ;
2724import type {
2825 MultisigChain ,
@@ -245,26 +242,14 @@ export class BtcMultisigAdapter implements ChainAdapter {
245242 ) : Promise < boolean > {
246243 try {
247244 const pubkeyBuf = parsePubkey ( signerPubkey ) ;
248- < < < << << HEAD
249245 const txHash = txData . tx_hash_to_sign as string | undefined ;
250246
251247 // Check that the pubkey is one of the expected participants when provided.
252- === === =
253- const sigBuf = Buffer . from ( signature , 'hex' ) ;
254-
255- // Verify the hash matches the pubkey and signature
256- // In production, this would verify the actual PSBT input signature
257- const witnessScript = txData . witness_script as string ;
258- if ( ! witnessScript ) return false ;
259-
260- // Check that the pubkey is one of the multisig participants
261- >>> > >>> feat / multisig - escrow
262248 const pubkeys = txData . pubkeys as string [ ] | undefined ;
263249 if ( pubkeys && ! pubkeys . includes ( signerPubkey ) ) {
264250 return false ;
265251 }
266252
267- << < < < << HEAD
268253 // tx_hash_to_sign is required for cryptographic verification.
269254 // Fail closed when missing/malformed.
270255 if ( ! txHash || txHash . length !== 64 ) {
@@ -289,10 +274,6 @@ export class BtcMultisigAdapter implements ChainAdapter {
289274 if ( sigBuf . length !== 64 ) return false ;
290275 return secp256k1 . verify ( msgHash , pubkeyBuf , sigBuf ) ;
291276 }
292- === = ===
293- // Basic signature format validation (DER-encoded or Schnorr)
294- return sigBuf . length >= 64 && pubkeyBuf . length >= 33 ;
295- >>> > >>> feat / multisig - escrow
296277 } catch {
297278 return false ;
298279 }
@@ -312,11 +293,7 @@ export class BtcMultisigAdapter implements ChainAdapter {
312293 }
313294
314295 if ( signatures . length < 2 ) {
315- << < < < << HEAD
316296 return { tx_hash : '' , success : false , broadcasted : false } ;
317- === === =
318- return { tx_hash : '' , success : false } ;
319- >>> > >>> feat / multisig - escrow
320297 }
321298
322299 // In production:
@@ -334,10 +311,7 @@ export class BtcMultisigAdapter implements ChainAdapter {
334311 return {
335312 tx_hash : txid ,
336313 success : true ,
337- << < < < << HEAD
338314 broadcasted : false ,
339- === = ===
340- > >>> > >> feat / multisig - escrow
341315 } ;
342316 }
343317}
0 commit comments