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,
|
refreshGroupId: string,
|
||||||
coinIndex: number,
|
coinIndex: number,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
logger.info("doing refresh reveal");
|
logger.info(
|
||||||
|
`doing refresh reveal for ${refreshGroupId} (old coin ${coinIndex})`,
|
||||||
|
);
|
||||||
const d = await ws.db
|
const d = await ws.db
|
||||||
.mktx((x) => [x.refreshGroups, x.coins, x.denominations])
|
.mktx((x) => [x.refreshGroups, x.coins, x.denominations])
|
||||||
.runReadOnly(async (tx) => {
|
.runReadOnly(async (tx) => {
|
||||||
|
@ -810,6 +810,10 @@ export async function makeCoinAvailable(
|
|||||||
}>,
|
}>,
|
||||||
coinRecord: CoinRecord,
|
coinRecord: CoinRecord,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const existingCoin = await tx.coins.get(coinRecord.coinPub);
|
||||||
|
if (existingCoin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const denom = await tx.denominations.get([
|
const denom = await tx.denominations.get([
|
||||||
coinRecord.exchangeBaseUrl,
|
coinRecord.exchangeBaseUrl,
|
||||||
coinRecord.denomPubHash,
|
coinRecord.denomPubHash,
|
||||||
|
Loading…
Reference in New Issue
Block a user