@bsv/wallet-toolbox 1.7.0 → 1.7.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 +4 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts +2 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/getBeefForTransaction.js +10 -4
- package/mobile/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +2 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +10 -4
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/sdk/WalletStorage.interfaces.ts +2 -0
- package/src/storage/methods/getBeefForTransaction.ts +10 -4
package/package.json
CHANGED
|
@@ -390,6 +390,8 @@ export interface StorageGetBeefOptions {
|
|
|
390
390
|
minProofLevel?: number
|
|
391
391
|
/** optional. If valid, any merkleRoot that fails to validate will result in an exception without merging to `mergeToBeef`. */
|
|
392
392
|
chainTracker?: ChainTracker
|
|
393
|
+
/** optional. Default is false. If chainTracker is valid and an invalid proof is found: if true, pursues deeper beef. If false, throws WERR_INVALID_MERKLE_ROOT. */
|
|
394
|
+
skipInvalidProofs?: boolean
|
|
393
395
|
}
|
|
394
396
|
|
|
395
397
|
export interface StorageSyncReaderOptions {
|
|
@@ -107,12 +107,18 @@ async function mergeBeefForTransactionRecurse(
|
|
|
107
107
|
const root = mp.computeRoot()
|
|
108
108
|
const isValid = await options.chainTracker.isValidRootForHeight(root, r.proven.height)
|
|
109
109
|
if (!isValid) {
|
|
110
|
-
|
|
110
|
+
if (!options.skipInvalidProofs) {
|
|
111
|
+
throw new WERR_INVALID_MERKLE_ROOT(r.proven.blockHash, r.proven.height, root, txid)
|
|
112
|
+
}
|
|
113
|
+
// ignore this currently invalid proof and try to recurse deeper
|
|
114
|
+
r.proven = undefined
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
if (r.proven) {
|
|
118
|
+
beef.mergeRawTx(r.proven.rawTx)
|
|
119
|
+
beef.mergeBump(mp)
|
|
120
|
+
return beef
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
if (!r.rawTx) throw new WERR_INVALID_PARAMETER(`txid ${txid}`, `valid transaction on chain ${storage.chain}`)
|