diff options
| author | Adam Soltys <[email protected]> | 2024-12-02 22:50:11 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-12-02 22:50:11 -0800 |
| commit | 5a8c49ad031dcb175ff4a0dec71c818eeab0b491 (patch) | |
| tree | 9e78528c72256700df1b966519ec200cb8b86f05 /lib/payments.ts | |
| parent | 2484b61e149273d788170c4d64e679b5b0f8155d (diff) | |
| download | coinos-server-5a8c49ad031dcb175ff4a0dec71c818eeab0b491.tar.gz coinos-server-5a8c49ad031dcb175ff4a0dec71c818eeab0b491.zip | |
detect duplicate keysend
Diffstat (limited to 'lib/payments.ts')
| -rw-r--r-- | lib/payments.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index 7f0ab968..76a7d1fa 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -416,6 +416,7 @@ export const sendOnchain = async (params) => { }; export const sendKeysend = async ({ + hash, amount, pubkey, fee = undefined, @@ -424,8 +425,11 @@ export const sendKeysend = async ({ }) => { fee = Math.max(parseInt(fee || amount * 0.005), 5); - const p = await debit({ - hash: v4(), + let p = await g(`payment:${hash}`); + if (p) fail("duplicate keysend"); + + p = await debit({ + hash, amount, fee, memo, |
