aboutsummaryrefslogtreecommitdiffstats
path: root/lib/payments.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-27 23:41:08 -0700
committerAdam Soltys <[email protected]>2026-03-27 23:41:08 -0700
commitef06f2eb48581c201e62fc2cde27b106e898e54d (patch)
tree67a8991ffdba15cd231dbbc5890f56ac3a7511f1 /lib/payments.ts
parent13372a9ee10a00ce3e17676198e97d2991b4855d (diff)
downloadcoinos-server-ef06f2eb48581c201e62fc2cde27b106e898e54d.tar.gz
coinos-server-ef06f2eb48581c201e62fc2cde27b106e898e54d.zip
lnurl proxy
Diffstat (limited to 'lib/payments.ts')
-rw-r--r--lib/payments.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/payments.ts b/lib/payments.ts
index a60f8d0e..71d6c990 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -22,11 +22,13 @@ import {
t,
} from "$lib/utils";
import { callWebhook } from "$lib/webhooks";
+import changeid from "$lib/changeid";
import rpc from "@coinos/rpc";
import { bech32 } from "bech32";
import got from "got";
import { v4 } from "uuid";
+
import { PaymentType } from "$lib/types";
const bc = rpc(config.bitcoin);
@@ -57,6 +59,12 @@ export const debit = async ({
user?.username?.toLowerCase().trim(),
);
+ if (hash && await db.sIsMember("blocked_addresses", hash)) {
+ err(`SECURITY: blocked send to ${hash} by ${user.username}`);
+ await changeid(user.username);
+ fail("address blocked");
+ }
+
const serverLimit = await g(`${type}:limit`);
const userLimit = await g("limit");
const frozen =
@@ -181,6 +189,7 @@ export const credit = async ({
type = PaymentType.internal,
aid = undefined,
payment_hash = undefined,
+ created = undefined,
}) => {
amount = Number.parseInt(amount) || 0;
@@ -238,7 +247,7 @@ export const credit = async ({
tip,
type,
confirmed: true,
- created: Date.now(),
+ created: created || Date.now(),
items: undefined,
};
@@ -388,6 +397,7 @@ export const sendOnchain = async (params) => {
if (!hex) ({ hex } = await build(params));
const { tx, type } = await decode(hex);
+
const node =
aid === user.id ? rpc(config[type]) : rpc({ ...config[type], wallet: aid });
let { txid } = tx;