make sure the 'testing withdraw' subcommand does retries

This commit is contained in:
Florian Dold 2020-03-23 17:33:38 +05:30
parent 0e51d45ec0
commit 1b0b3f146c
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 5 additions and 3 deletions

View File

@ -158,6 +158,9 @@ export async function withdrawTestBalance(
]); ]);
const donePromise = new Promise((resolve, reject) => { const donePromise = new Promise((resolve, reject) => {
myWallet.runRetryLoop().catch((x) => {
reject(x);
});
myWallet.addNotificationListener(n => { myWallet.addNotificationListener(n => {
if ( if (
n.type === NotificationType.ReserveDepleted && n.type === NotificationType.ReserveDepleted &&
@ -169,7 +172,6 @@ export async function withdrawTestBalance(
}); });
await bank.createReserve(bankUser, amount, reservePub, exchangePaytoUri); await bank.createReserve(bankUser, amount, reservePub, exchangePaytoUri);
await myWallet.confirmReserve({ reservePub: reserveResponse.reservePub }); await myWallet.confirmReserve({ reservePub: reserveResponse.reservePub });
await donePromise; await donePromise;
} }

View File

@ -195,7 +195,7 @@ export async function createReserve(
// Asynchronously process the reserve, but return // Asynchronously process the reserve, but return
// to the caller already. // to the caller already.
processReserve(ws, resp.reservePub, true).catch(e => { processReserve(ws, resp.reservePub, true).catch(e => {
console.error("Processing reserve failed:", e); console.error("Processing reserve (after createReserve) failed:", e);
}); });
return resp; return resp;
@ -604,7 +604,7 @@ export async function confirmReserve(
ws.notify({ type: NotificationType.ReserveUpdated }); ws.notify({ type: NotificationType.ReserveUpdated });
processReserve(ws, req.reservePub, true).catch(e => { processReserve(ws, req.reservePub, true).catch(e => {
console.log("processing reserve failed:", e); console.log("processing reserve (after confirmReserve) failed:", e);
}); });
} }