wallet-core: make coin availability accounting idempotent
This commit is contained in:
parent
d759c7e78a
commit
d34f8e48da
@ -522,7 +522,9 @@ async function refreshReveal(
|
||||
refreshGroupId: string,
|
||||
coinIndex: number,
|
||||
): Promise<void> {
|
||||
logger.info("doing refresh reveal");
|
||||
logger.info(
|
||||
`doing refresh reveal for ${refreshGroupId} (old coin ${coinIndex})`,
|
||||
);
|
||||
const d = await ws.db
|
||||
.mktx((x) => [x.refreshGroups, x.coins, x.denominations])
|
||||
.runReadOnly(async (tx) => {
|
||||
|
@ -810,6 +810,10 @@ export async function makeCoinAvailable(
|
||||
}>,
|
||||
coinRecord: CoinRecord,
|
||||
): Promise<void> {
|
||||
const existingCoin = await tx.coins.get(coinRecord.coinPub);
|
||||
if (existingCoin) {
|
||||
return;
|
||||
}
|
||||
const denom = await tx.denominations.get([
|
||||
coinRecord.exchangeBaseUrl,
|
||||
coinRecord.denomPubHash,
|
||||
|
Loading…
Reference in New Issue
Block a user