Skip to content

Commit

Permalink
Merge pull request #15 from bitcoinerlab/fix-self-push
Browse files Browse the repository at this point in the history
Fix self push
  • Loading branch information
landabaso authored Sep 20, 2024
2 parents 5ba0d7b + 9245a59 commit ed6d9d1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 67 deletions.
94 changes: 35 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bitcoinerlab/discovery",
"description": "A TypeScript library for retrieving Bitcoin funds from ranged descriptors, leveraging @bitcoinerlab/explorer for standardized access to multiple blockchain explorers.",
"homepage": "https://github.com/bitcoinerlab/discovery",
"version": "1.2.5",
"version": "1.2.6",
"author": "Jose-Luis Landabaso",
"license": "MIT",
"prettier": "@bitcoinerlab/configs/prettierConfig.json",
Expand Down Expand Up @@ -43,8 +43,8 @@
"dist"
],
"dependencies": {
"@bitcoinerlab/descriptors": "^2.1.0",
"@bitcoinerlab/explorer": "^0.3.0",
"@bitcoinerlab/descriptors": "^2.2.0",
"@bitcoinerlab/explorer": "^0.3.2",
"@bitcoinerlab/secp256k1": "^1.1.1",
"@types/memoizee": "^0.4.8",
"bitcoinjs-lib": "^6.1.5",
Expand Down
8 changes: 3 additions & 5 deletions src/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1342,11 +1342,9 @@ export function DiscoveryFactory(
throw new Error(
`unset index ${index} for descriptor ${descriptor}`
);
if (outputData.txIds.includes(txId))
throw new Error(
`txId ${txId} was already pushed or part of the discovery object`
);
outputData.txIds.push(txId);
//Note that update is called twice (for inputs and outputs), so
//don't push twice when auto-sending from same utxo to same output
if (!outputData.txIds.includes(txId)) outputData.txIds.push(txId);
if (!txMap[txId]) txMap[txId] = txData; //Only add it once
};

Expand Down
1 change: 1 addition & 0 deletions test/integration/discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ for (const network of [networks.bitcoin]) {
explorer: new EsploraExplorer({
url: 'https://blockstream.info/api/',
requestQueueParams: {
maxConcurrentTasks: 10
//maxConcurrentTasks: 30
//maxConcurrentTasks: 5 //default is 10
//maxAttemptsForHardErrors: 10 //default is 5
Expand Down

0 comments on commit ed6d9d1

Please sign in to comment.