@exodus/bitcoin-api 4.15.9 → 4.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +2 -2
- package/src/tx-log/bitcoin-monitor-scanner.js +20 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.15.10](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.9...@exodus/bitcoin-api@4.15.10) (2026-06-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix(bitcoin): yield between address derivation batches during gap scan (#8255)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [4.15.9](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.8...@exodus/bitcoin-api@4.15.9) (2026-06-08)
|
|
7
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.10",
|
|
4
4
|
"description": "Bitcoin transaction and fee monitors, RPC with the blockchain node, other networking code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "e307446f4085795c9eb2085c4a2bf009b7d2297d"
|
|
67
67
|
}
|
|
@@ -14,6 +14,10 @@ const SENT_TIME_TO_DROP = ms('2m')
|
|
|
14
14
|
|
|
15
15
|
const COINBASE_MATURITY_HEIGHT = 100
|
|
16
16
|
|
|
17
|
+
// Derive addresses in batches, yielding between them, so a long multisig gap
|
|
18
|
+
// scan (synchronous secp256k1 work) doesn't starve the event loop (timers, RPC).
|
|
19
|
+
const ADDRESS_DERIVATION_BATCH_SIZE = 10
|
|
20
|
+
|
|
17
21
|
export class BitcoinMonitorScanner {
|
|
18
22
|
#asset
|
|
19
23
|
#insightClient
|
|
@@ -162,7 +166,7 @@ export class BitcoinMonitorScanner {
|
|
|
162
166
|
// NOTE: the hope is that this gets replaced with a fetch by xpub method and then following the chain here won't be necessary
|
|
163
167
|
|
|
164
168
|
const aggregateAddresses = async (chainObjects) => {
|
|
165
|
-
const
|
|
169
|
+
const tasks = []
|
|
166
170
|
for (const chainObject of chainObjects) {
|
|
167
171
|
const { purpose, chainIndex, startAddressIndex, endAddressIndex } = chainObject
|
|
168
172
|
for (
|
|
@@ -172,7 +176,7 @@ export class BitcoinMonitorScanner {
|
|
|
172
176
|
) {
|
|
173
177
|
const index = multisigDataLength ?? 1
|
|
174
178
|
for (let i = 0; i < index; i++) {
|
|
175
|
-
|
|
179
|
+
tasks.push(() =>
|
|
176
180
|
assetClientInterface
|
|
177
181
|
.getAddress({
|
|
178
182
|
assetName,
|
|
@@ -209,12 +213,20 @@ export class BitcoinMonitorScanner {
|
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
const addresses = []
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
for (let i = 0; i < tasks.length; i += ADDRESS_DERIVATION_BATCH_SIZE) {
|
|
217
|
+
const batch = await Promise.all(
|
|
218
|
+
tasks.slice(i, i + ADDRESS_DERIVATION_BATCH_SIZE).map((task) => task())
|
|
219
|
+
)
|
|
220
|
+
batch.filter(Boolean).forEach(({ address, purpose }) => {
|
|
221
|
+
purposeMap[String(address)] = purpose
|
|
222
|
+
addresses.push(String(address))
|
|
223
|
+
})
|
|
224
|
+
// Yield so pending timers / RPC can run instead of being starved for the whole scan.
|
|
225
|
+
if (i + ADDRESS_DERIVATION_BATCH_SIZE < tasks.length) {
|
|
226
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
218
230
|
return addresses
|
|
219
231
|
}
|
|
220
232
|
|