@bsv/wallet-toolbox 1.6.30 → 1.6.31
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/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/mobile/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/createAction.js +15 -1
- package/mobile/out/src/storage/methods/createAction.js.map +1 -1
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +15 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/services/chaintracker/chaintracks/util/ChaintracksFetch.ts +1 -1
- package/src/storage/methods/createAction.ts +18 -2
package/package.json
CHANGED
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
PubKeyHex,
|
|
9
9
|
PublicKey,
|
|
10
10
|
Random,
|
|
11
|
+
ReviewActionResult,
|
|
11
12
|
Script,
|
|
12
|
-
Utils
|
|
13
|
+
Utils,
|
|
14
|
+
WERR_REVIEW_ACTIONS
|
|
13
15
|
} from '@bsv/sdk'
|
|
14
16
|
import {
|
|
15
17
|
generateChangeSdk,
|
|
@@ -224,11 +226,25 @@ async function createNewInputs(
|
|
|
224
226
|
if (o) {
|
|
225
227
|
await storage.transaction(async trx => {
|
|
226
228
|
const o2 = verifyOne(await storage.findOutputs({ partial: { outputId: o.outputId }, trx }))
|
|
227
|
-
if (o2.
|
|
229
|
+
if (o2.spentBy !== undefined) {
|
|
230
|
+
const spendingTx = await storage.findTransactionById(verifyId(o2.spentBy), trx)
|
|
231
|
+
if (spendingTx && spendingTx.txid) {
|
|
232
|
+
const beef = await storage.getBeefForTransaction(spendingTx.txid, {})
|
|
233
|
+
const rar: ReviewActionResult = {
|
|
234
|
+
txid: '',
|
|
235
|
+
status: 'doubleSpend',
|
|
236
|
+
competingTxs: [spendingTx.txid!],
|
|
237
|
+
competingBeef: beef.toBinary()
|
|
238
|
+
}
|
|
239
|
+
throw new WERR_REVIEW_ACTIONS([rar], [])
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (o2.spendable != true) {
|
|
228
243
|
throw new WERR_INVALID_PARAMETER(
|
|
229
244
|
`inputs[${i.vin}]`,
|
|
230
245
|
`spendable output. output ${o.txid}:${o.vout} appears to have been spent.`
|
|
231
246
|
)
|
|
247
|
+
}
|
|
232
248
|
await storage.updateOutput(
|
|
233
249
|
o.outputId!,
|
|
234
250
|
{
|