Skip to content

Commit

Permalink
Fix bug with parsing PSBT and knownEmptyTxids
Browse files Browse the repository at this point in the history
  • Loading branch information
victorkirov committed Dec 19, 2024
1 parent c9e9782 commit 92033be
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 92033be

Please sign in to comment.