aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.ts1
-rw-r--r--routes/payments.ts34
2 files changed, 7 insertions, 28 deletions
diff --git a/index.ts b/index.ts
index a322407e..e04db942 100644
--- a/index.ts
+++ b/index.ts
@@ -119,7 +119,6 @@ app.post("/send/:lnaddress/:amount", auth, payments.lnaddress);
app.post("/send", auth, payments.internal);
app.post("/gateway", payments.gateway);
app.post("/bump", auth, payments.bump);
-app.post("/bump/estimate", auth, payments.bumpEstimate);
app.get("/decode/:bolt11", payments.decode);
app.post("/fetchinvoice", payments.fetchinvoice);
app.get("/ark/address", payments.arkAddress);
diff --git a/routes/payments.ts b/routes/payments.ts
index ab876823..f9688d2b 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -9,7 +9,7 @@ import { replay } from "$lib/lightning";
import ln from "$lib/ln";
import { err, l, warn } from "$lib/logging";
import mqtt from "$lib/mqtt";
-import { createCpfpChild, estimateBumpCost } from "$lib/cpfp";
+import { createCpfpChild } from "$lib/cpfp";
import {
acquireArkLock,
build,
@@ -759,7 +759,7 @@ export default {
async bump(c) {
const body = await c.req.json();
- const { id, targetFeeRate } = body;
+ const { id } = body;
const user = c.get("user");
try {
const p = await gf(`payment:${id}`);
@@ -770,6 +770,11 @@ export default {
if (!p.bumpReserve || p.bumpReserve <= 0) fail("no bump reserve available");
if (p.childTxid) fail("transaction already bumped");
+ const fees: any = await fetch(`${api[PaymentType.bitcoin]}/fees/recommended`).then((r) =>
+ r.json(),
+ );
+ const targetFeeRate = Math.ceil(fees.fastestFee * 1.5);
+
const { txid, childFee } = await createCpfpChild(p, targetFeeRate);
return c.json({
@@ -783,31 +788,6 @@ export default {
}
},
- async bumpEstimate(c) {
- const body = await c.req.json();
- const { id, targetFeeRate } = body;
- const user = c.get("user");
- try {
- const p = await gf(`payment:${id}`);
- if (!p) fail("Payment not found");
- if (p.uid !== user.id) fail("unauthorized");
-
- const cost = estimateBumpCost(p.fee, p.parentVsize, targetFeeRate);
-
- const fees: any = await fetch(`${api[PaymentType.bitcoin]}/fees/recommended`).then((r) =>
- r.json(),
- );
-
- return c.json({
- cost,
- fees,
- bumpReserve: p.bumpReserve || 0,
- });
- } catch (e) {
- return bail(c, e.message);
- }
- },
-
async internal(c) {
const body = await c.req.json();
const { username, amount } = body;