aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-08-18 21:38:45 -0700
committerAdam Soltys <[email protected]>2024-08-18 21:38:45 -0700
commit6bce7c842ef5665edfce9bebadfb62b95ae40111 (patch)
tree505773daf88a458d5d56a90c3148a6eddf2ed2bf /lib
parentf8cfd7e189c62c6325a126df1dda3b24cb1bbc36 (diff)
downloadcoinos-server-6bce7c842ef5665edfce9bebadfb62b95ae40111.tar.gz
coinos-server-6bce7c842ef5665edfce9bebadfb62b95ae40111.zip
increase allowed memo length
Diffstat (limited to 'lib')
-rw-r--r--lib/invoices.js2
-rw-r--r--lib/payments.js12
2 files changed, 3 insertions, 11 deletions
diff --git a/lib/invoices.js b/lib/invoices.js
index 55223674..b07ac1f5 100644
--- a/lib/invoices.js
+++ b/lib/invoices.js
@@ -42,7 +42,7 @@ export let generate = async ({ invoice, user, sender }) => {
if (amount < 0) fail("invalid amount");
if (tip < 0) fail("invalid tip");
if (rate < 0) fail("invalid rate");
- if (memo && memo.length > 200) fail("memo too long");
+ if (memo && memo.length > 5000) fail("memo too long");
let id = v4();
diff --git a/lib/payments.js b/lib/payments.js
index c7fd41b0..264a2417 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -28,21 +28,16 @@ import api from "$lib/api";
import lq from "$lib/liquid";
import bc from "$lib/bitcoin";
import ln from "$lib/ln";
-import { balance, melt, mint } from "$lib/ecash";
let { URL } = process.env;
-setTimeout(
- async () => console.log("bob", await balance(await getUser("bob"))),
- 1000,
-);
-
export let types = {
internal: "internal",
bitcoin: "bitcoin",
lightning: "lightning",
fund: "fund",
liquid: "liquid",
+ ecash: "ecash",
};
export let debit = async ({
@@ -90,7 +85,6 @@ export let debit = async ({
? Math.round((amount + fee + tip) * config.fee)
: 0;
- await melt(user, amount + fee + tip + ourfee);
ourfee = await db.debit(
`balance:${uid}`,
`credit:${type}:${uid}`,
@@ -144,7 +138,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
tip = parseInt(tip) || 0;
if (!memo) ({ memo } = inv);
- if (memo && memo.length > 200) fail("memo too long");
+ if (memo && memo.length > 5000) fail("memo too long");
if (amount < 0 || tip < 0) fail("Invalid amount");
if (type === types.internal) amount += tip;
@@ -188,8 +182,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
inv.preimage = ref;
}
- await mint(user, amount);
-
let balanceKey = "balance";
if ([types.bitcoin, types.liquid].includes(type)) {
let [txid, vout] = ref.split(":").slice(-2);