wallet-core: fixup for coin availability (visible coins)
This commit is contained in:
parent
3f4526847b
commit
93ab00e601
@ -2152,10 +2152,8 @@ export interface CoinAvailabilityRecord {
|
|||||||
* Number of fresh coins that are available
|
* Number of fresh coins that are available
|
||||||
* and visible, i.e. the source transaction is in
|
* and visible, i.e. the source transaction is in
|
||||||
* a final state.
|
* a final state.
|
||||||
*
|
|
||||||
* (Optional for backwards compatibility, defaults to 0.)
|
|
||||||
*/
|
*/
|
||||||
visibleCoinCount?: number;
|
visibleCoinCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContractTermsRecord {
|
export interface ContractTermsRecord {
|
||||||
@ -2942,6 +2940,17 @@ export const walletDbFixups: FixupDescription[] = [
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "CoinAvailabilityRecord_visibleCoinCount_add",
|
||||||
|
async fn(tx): Promise<void> {
|
||||||
|
await tx.coinAvailability.iter().forEachAsync(async (r) => {
|
||||||
|
if (r.visibleCoinCount == null) {
|
||||||
|
r.visibleCoinCount = r.freshCoinCount;
|
||||||
|
await tx.coinAvailability.put(r);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const logger = new Logger("db.ts");
|
const logger = new Logger("db.ts");
|
||||||
|
@ -147,6 +147,7 @@ export async function makeCoinAvailable(
|
|||||||
denomPubHash: denom.denomPubHash,
|
denomPubHash: denom.denomPubHash,
|
||||||
exchangeBaseUrl: denom.exchangeBaseUrl,
|
exchangeBaseUrl: denom.exchangeBaseUrl,
|
||||||
freshCoinCount: 0,
|
freshCoinCount: 0,
|
||||||
|
visibleCoinCount: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
car.freshCoinCount++;
|
car.freshCoinCount++;
|
||||||
|
Loading…
Reference in New Issue
Block a user