diff options
| author | Adam Soltys <[email protected]> | 2026-03-01 12:45:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-01 12:45:52 -0800 |
| commit | 5db704c583904a941e4a99f9c43fef2128207e92 (patch) | |
| tree | d9c096acbcecadd1bc8bf5f64ca28fa6c62148a7 | |
| parent | 51e01eb2dc6e7976963c31b9349c4e621c535874 (diff) | |
| download | coinos-server-5db704c583904a941e4a99f9c43fef2128207e92.tar.gz coinos-server-5db704c583904a941e4a99f9c43fef2128207e92.zip | |
wallet check
| -rw-r--r-- | lib/ark.ts | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -115,13 +115,15 @@ export const sendArk = async (address: string, amount: number) => { setTimeout(() => reject(new Error("Ark send timed out")), 60000), ); const send = async () => { - const w = await getWallet(); + let w = await getWallet(); try { return await w.sendBitcoin({ address, amount }); } catch (e: any) { - if (/insufficient funds/i.test(e.message)) { - l("ark send got insufficient funds, refreshing wallet and retrying"); + if (/insufficient funds/i.test(e.message) || /VTXO_RECOVERABLE/i.test(e.message) || /VTXO_ALREADY_SPENT/i.test(e.message) || /VTXO_ALREADY_REGISTERED/i.test(e.message)) { + l("ark send failed:", e.message, "— recreating wallet and retrying"); + wallet = null; await refreshArkWallet(true); + w = await getWallet(); return w.sendBitcoin({ address, amount }); } throw e; |
