Skip to content

Commit

Permalink
Merge pull request #300 from secretkeylabs/vic/fix-psbt-bug
Browse files Browse the repository at this point in the history
Fix bug with parsing PSBT and knownEmptyTxids
  • Loading branch information
victorkirov authored Dec 19, 2024
2 parents c9e9782 + 92033be commit 08ee0c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions transactions/bitcoin/enhancedPsbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { concatBytes } from 'micro-packed';

import { getRunesClient } from '../../api';
import { UTXO } from '../../types';
import { getBtcNetwork, getBtcNetworkDefinition, isInscriptionsAndRunesCompatible } from '../btcNetwork';
import { getBtcNetworkDefinition, isInscriptionsAndRunesCompatible } from '../btcNetwork';
import { InputToSign, TransactionContext } from './context';
import { ExtendedDummyUtxo, ExtendedUtxo } from './extendedUtxo';
import {
Expand Down Expand Up @@ -184,13 +184,14 @@ export class EnhancedPsbt {
inputTxid: string,
knownEmptyTxids?: string[],
) => {
if (knownEmptyTxids && !knownEmptyTxids.includes(inputTxid)) {
if (!knownEmptyTxids?.includes(inputTxid)) {
const addressInput = await this._context.getUtxoFallbackToExternal(`${inputTxid}:${inputRaw.index}`);
if (addressInput && addressInput.extendedUtxo) {
return addressInput.extendedUtxo;
}
}

// we know this UTXO won't exist, so we create a dummy one
const utxo: UTXO = {
txid: inputTxid,
vout: inputRaw.index!,
Expand Down

0 comments on commit 08ee0c2

Please sign in to comment.