Fix counter mutations

This commit is contained in:
minibits-cash
2026-01-09 23:50:05 +01:00
parent 5b4b96c490
commit c6990e6944
2 changed files with 12 additions and 5 deletions
+7
View File
@@ -206,6 +206,13 @@ export const MintProofsCounterModel = types
counter: self.counter, counter: self.counter,
}) })
}, },
setProofsCounter(newCounter: number) {
self.counter = newCounter
log.debug('[setProofsCounter]', 'Set proofsCounter', {
counter: self.counter,
})
},
})) }))
.views(self => ({ .views(self => ({
// === In-flight requests === // === In-flight requests ===
+5 -5
View File
@@ -403,7 +403,7 @@ export const WalletStoreModel = types
throw new AppError(Err.VALIDATION_ERROR, 'Missing mint instance', {mintUrl}) throw new AppError(Err.VALIDATION_ERROR, 'Missing mint instance', {mintUrl})
} }
const cashuWallet = yield self.getWallet( const cashuWallet: CashuWallet = yield self.getWallet(
mintUrl, mintUrl,
unit, unit,
{ {
@@ -474,7 +474,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x) // Update our counter to match what the wallet used (v3.x)
if (reservedCounters) { if (reservedCounters) {
currentCounter.counter = reservedCounters.next currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[receive] Updated counter', { log.debug('[receive] Updated counter', {
keysetId: reservedCounters.keysetId, keysetId: reservedCounters.keysetId,
start: reservedCounters.start, start: reservedCounters.start,
@@ -589,7 +589,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x) // Update our counter to match what the wallet used (v3.x)
if (reservedCounters) { if (reservedCounters) {
currentCounter.counter = reservedCounters.next currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[send] Updated counter', { log.debug('[send] Updated counter', {
keysetId: reservedCounters.keysetId, keysetId: reservedCounters.keysetId,
start: reservedCounters.start, start: reservedCounters.start,
@@ -818,7 +818,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x) // Update our counter to match what the wallet used (v3.x)
if (reservedCounters) { if (reservedCounters) {
currentCounter.counter = reservedCounters.next currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[mintProofs] Updated counter', { log.debug('[mintProofs] Updated counter', {
keysetId: reservedCounters.keysetId, keysetId: reservedCounters.keysetId,
start: reservedCounters.start, start: reservedCounters.start,
@@ -942,7 +942,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x) // Update our counter to match what the wallet used (v3.x)
if (reservedCounters) { if (reservedCounters) {
currentCounter.counter = reservedCounters.next currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[prepareMelt] Updated counter', { log.debug('[prepareMelt] Updated counter', {
keysetId: reservedCounters.keysetId, keysetId: reservedCounters.keysetId,
start: reservedCounters.start, start: reservedCounters.start,