@exodus/bitcoin-api 5.1.0 → 5.1.1

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 CHANGED
@@ -3,6 +3,15 @@
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
+ ## [5.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@5.1.0...@exodus/bitcoin-api@5.1.1) (2026-11-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **bitcoin-api:** exclude pending send inputs from stale history ([#9380](https://github.com/ExodusMovement/assets/issues/9380)) ([3aa8738](https://github.com/ExodusMovement/assets/commit/3aa873848245e40573b24d08a77d45a0f8235d0b))
12
+
13
+
14
+
6
15
  ## [5.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@5.0.14...@exodus/bitcoin-api@5.1.0) (2026-11-16)
7
16
 
8
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
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",
@@ -60,5 +60,5 @@
60
60
  "type": "git",
61
61
  "url": "git+https://github.com/ExodusMovement/assets.git"
62
62
  },
63
- "gitHead": "2189bb5f649f746ce303d0453daf7c82ede80c8f"
63
+ "gitHead": "d0511126ddc16785880aabd6882c4a08edafef79"
64
64
  }
@@ -697,17 +697,7 @@ export class BitcoinMonitorScanner {
697
697
 
698
698
  const txIdsToCheck = new Set(Object.keys(unconfirmedTxsToCheck))
699
699
  if (refresh) {
700
- const refreshedTxIds = new Set(newTxs.map((tx) => tx.txId))
701
700
  const scannedTxIds = new Set([...allTxs, ...storedUtxoAddressTxs].map((tx) => tx.txid))
702
- // Refresh overwrites the tx log. Keep unindexed recent sends, including their
703
- // original date and inputs, so another refresh preserves the same grace period.
704
- // The extra stored-UTXO-address scan does not emit entries to the refreshed log.
705
- for (const tx of currentTxs) {
706
- if (tx.pending && isRecentSentTx(tx) && !refreshedTxIds.has(tx.txId)) {
707
- existingTxs.push({ ...tx })
708
- }
709
- }
710
-
711
701
  // A previous refresh may have removed a funding tx from the log while retaining
712
702
  // its UTXOs. Verify retained outputs independently of pending tx-log entries.
713
703
  for (const { txId } of utxoCol.toArray()) {
@@ -733,9 +723,11 @@ export class BitcoinMonitorScanner {
733
723
  })
734
724
  )
735
725
 
726
+ const droppedTxIds = new Set()
736
727
  for (const { txId, shouldDrop } of verificationResults) {
737
728
  if (!shouldDrop) continue
738
729
 
730
+ droppedTxIds.add(txId)
739
731
  utxoCol = utxoCol.difference(utxoCol.getTxIdUtxos(txId))
740
732
  const tx = unconfirmedTxsToCheck[txId]
741
733
  if (!tx) continue
@@ -768,6 +760,30 @@ export class BitcoinMonitorScanner {
768
760
  utxoCol = utxoCol.union(UtxoCollection.fromArray(utxosToAdd, { currency }))
769
761
  }
770
762
 
763
+ const pendingSpentOutpoints = new Set()
764
+ const refreshedTxIds = refresh ? new Set(newTxs.map((tx) => tx.txId)) : null
765
+ for (const tx of currentTxs) {
766
+ if (!tx.pending || !tx.sent || droppedTxIds.has(tx.txId)) continue
767
+
768
+ if (tx.data.inputs) {
769
+ const inputs = UtxoCollection.fromJSON(tx.data.inputs, { currency })
770
+ for (const input of inputs.toArray()) {
771
+ pendingSpentOutpoints.add(`${input.txId}-${input.vout}`)
772
+ }
773
+ }
774
+
775
+ // Refresh overwrites the log. Preserve unindexed sends and their original
776
+ // date/inputs until explicitly dropped, including when a status lookup fails.
777
+ if (refreshedTxIds && !refreshedTxIds.has(tx.txId)) {
778
+ existingTxs.push({ ...tx })
779
+ }
780
+ }
781
+ // Stale history can still list a local send's inputs as unspent. Exclude them
782
+ // after drop recovery too: another pending send may spend a restored input.
783
+ if (pendingSpentOutpoints.size > 0) {
784
+ utxoCol = utxoCol.filter((utxo) => !pendingSpentOutpoints.has(`${utxo.txId}-${utxo.vout}`))
785
+ }
786
+
771
787
  // no changes, ignore
772
788
  if (utxoCol.equals(storedUtxos)) {
773
789
  utxoCol = null