Skip to content

Commit

Permalink
UTXO signing secret deduplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Smrecz committed Oct 30, 2024
1 parent 1b44570 commit 568970f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const btcBasedTransactions = (
totalOutputs += item.satoshis
}
try {
const privateKeysToSign = []
const privateKeysToSign = new Set<string>()

for (const item of body.fromAddress) {
if (totalInputs >= totalOutputs) {
Expand All @@ -163,12 +163,12 @@ export const btcBasedTransactions = (
}),
])

if ('signatureId' in item) privateKeysToSign.push(item.signatureId)
else if ('privateKey' in item) privateKeysToSign.push(item.privateKey)
if ('signatureId' in item) privateKeysToSign.add(item.signatureId)
else if ('privateKey' in item) privateKeysToSign.add(item.privateKey)
}
}

return privateKeysToSign
return Array.from(privateKeysToSign)
} catch (e: any) {
if (e instanceof SdkError) {
throw e
Expand Down

0 comments on commit 568970f

Please sign in to comment.