mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
Fix: Improve stability of wallet topup transaction
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "minibits_wallet",
|
||||
"version": "0.1.9-beta.38",
|
||||
"version": "0.1.9-beta.39",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android:clean": "cd android && ./gradlew clean",
|
||||
|
||||
@@ -1282,17 +1282,45 @@ const _handlePendingTopupTask = async function (params: {paymentRequest: Payment
|
||||
)
|
||||
|
||||
let proofs: ProofV3[] = []
|
||||
|
||||
proofs = (await walletStore.mintProofs(
|
||||
mintUrl as string,
|
||||
amount,
|
||||
unit,
|
||||
mintQuote,
|
||||
{
|
||||
preference: amountPreferences,
|
||||
counter: lockedProofsCounter.inFlightFrom as number
|
||||
|
||||
try {
|
||||
proofs = (await walletStore.mintProofs(
|
||||
mintUrl as string,
|
||||
amount,
|
||||
unit,
|
||||
mintQuote,
|
||||
{
|
||||
preference: amountPreferences,
|
||||
counter: lockedProofsCounter.inFlightFrom as number
|
||||
}
|
||||
)) as ProofV3[]
|
||||
} catch (e: any) {
|
||||
if(e.message.includes('outputs have already been signed before')) {
|
||||
|
||||
log.error('[_handlePendingTopupTask] Increasing proofsCounter outdated values and repeating mintProofs.')
|
||||
lockedProofsCounter.resetInFlight(transactionId)
|
||||
lockedProofsCounter.increaseProofsCounter(10)
|
||||
lockedProofsCounter = await WalletUtils.lockAndSetInFlight(
|
||||
mintInstance,
|
||||
unit,
|
||||
countOfInFlightProofs,
|
||||
transactionId
|
||||
)
|
||||
|
||||
proofs = (await walletStore.mintProofs(
|
||||
mintUrl as string,
|
||||
amount,
|
||||
unit,
|
||||
mintQuote,
|
||||
{
|
||||
preference: amountPreferences,
|
||||
counter: lockedProofsCounter.inFlightFrom as number
|
||||
}
|
||||
)) as ProofV3[]
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
)) as ProofV3[]
|
||||
}
|
||||
|
||||
lockedProofsCounter.decreaseProofsCounter(countOfInFlightProofs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user