aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.js2
-rw-r--r--routes/payments.js35
-rw-r--r--routes/users.js4
3 files changed, 23 insertions, 18 deletions
diff --git a/index.js b/index.js
index db466d3e..9972baf5 100644
--- a/index.js
+++ b/index.js
@@ -64,7 +64,7 @@ app.post("/take", auth, payments.take);
app.post("/print", auth, payments.print);
app.post("/send/:lnaddress/:amount", auth, payments.lnaddress);
app.post("/gateway", payments.gateway);
-// app.post("/replace", auth, payments.replace);
+app.post("/replace", auth, payments.replace);
app.get("/encode", lnurl.encode);
app.get("/decode", lnurl.decode);
diff --git a/routes/payments.js b/routes/payments.js
index 403ed51f..5da5017f 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -411,8 +411,10 @@ export default {
let raw = await node.createRawTransaction(tx.vin, outputs);
+ console.log("FEES", fees)
+
let newTx = await node.fundRawTransaction(raw, {
- fee_rate: fees.fastestFee,
+ fee_rate: fees.fastestFee + 50,
replaceable: true,
subtractFeeFromOutputs: [],
});
@@ -420,27 +422,30 @@ export default {
let diff = sats(newTx.fee) - p.fee;
if (diff < 0) fail("fee must increase");
- let ourfee = Math.round(diff * config.fee) || 0;
+ console.log("DIFF", diff)
- ourfee = await db.debit(
- `balance:${uid}`,
- `credit:${type}:${uid}`,
- p.amount || 0,
- 0,
- diff,
- ourfee,
- );
+ // let ourfee = Math.round(diff * config.fee) || 0;
+ //
+ // ourfee = await db.debit(
+ // `balance:${uid}`,
+ // `credit:${type}:${uid}`,
+ // p.amount || 0,
+ // 0,
+ // diff,
+ // ourfee,
+ // );
if (config[type].walletpass)
await node.walletPassphrase(config[type].walletpass, 300);
p.hex = (await node.signRawTransactionWithWallet(newTx.hex)).hex;
let r = await node.testMempoolAccept([p.hex]);
if (!r[0].allowed) fail(`transaction rejected ${p.hex}`);
- p.hash = await node.sendRawTransaction(p.hex);
- p.fee = sats(newTx.fee);
- await s(`payment:${id}`, p);
- await s(`payment:${p.hash}`, id);
- emit(uid, "payment", p);
+ warn("bump", user.username, p.hex);
+ // p.hash = await node.sendRawTransaction(p.hex);
+ // p.fee = sats(newTx.fee);
+ // await s(`payment:${id}`, p);
+ // await s(`payment:${p.hash}`, id);
+ // emit(uid, "payment", p);
res.send({ ok: true });
} catch (e) {
diff --git a/routes/users.js b/routes/users.js
index 949dd205..82575662 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -289,7 +289,7 @@ export default {
try {
let { username, password, token: twofa } = req.body;
- if (username !== "coinos")
+ if (username !== "coinos" && username !== "funk")
l("logging in", username, req.headers["cf-connecting-ip"]);
username = username.toLowerCase().replace(/\s/g, "");
@@ -316,7 +316,7 @@ export default {
return res.code(401).send("2fa required");
}
- if (username !== "coinos") l("logged in", username);
+ if (username !== "coinos" && username !== "funk") l("logged in", username);
let payload = { id: user.id };
let token = jwt.sign(payload, config.jwt);