aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin
diff options
context:
space:
mode:
Diffstat (limited to 'routes/bitcoin')
-rw-r--r--routes/bitcoin/fee.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/routes/bitcoin/fee.js b/routes/bitcoin/fee.js
index 220fbae9..da0fb9e9 100644
--- a/routes/bitcoin/fee.js
+++ b/routes/bitcoin/fee.js
@@ -3,12 +3,19 @@ module.exports = ah(async (req, res) => {
let { address, amount, feeRate } = req.body;
let tx, fee;
- let recipient = await db.User.findOne({
- attributes: ['username'],
- where: { address }
+ let invoice = await db.Invoice.findOne({
+ where: { address },
+ include: {
+ attributes: ['username'],
+ model: db.User,
+ as: 'user',
+ }
});
- if (recipient)
- emit(user.username, "to", recipient);
+
+ if (invoice) {
+ emit(user.username, "to", invoice.user);
+ return res.end();
+ }
try {
amount = parseInt(amount);