From e3ac717ada0234c1cc11ac8717c33202ab92ea0c Mon Sep 17 00:00:00 2001 From: Bucko Date: Mon, 18 Sep 2017 18:55:44 -0700 Subject: [PATCH] use req.wallet for lock coin endpoints --- lib/wallet/http.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/wallet/http.js b/lib/wallet/http.js index 6f60391e..c0f68fcb 100644 --- a/lib/wallet/http.js +++ b/lib/wallet/http.js @@ -636,7 +636,7 @@ HTTPServer.prototype.initRouter = function initRouter() { // Locked coins this.get('/:id/locked', async (req, res) => { - const locked = this.wallet.getLocked(); + const locked = await req.wallet.getLocked(); const result = []; for (const outpoint of locked) @@ -655,8 +655,8 @@ HTTPServer.prototype.initRouter = function initRouter() { enforce(index != null, 'Index is required.'); const outpoint = new Outpoint(hash, index); - - this.wallet.lockCoin(outpoint); + await req.wallet.lockCoin(outpoint); + res.send(200, { success: true }); }); // Unlock coin @@ -670,7 +670,8 @@ HTTPServer.prototype.initRouter = function initRouter() { const outpoint = new Outpoint(hash, index); - this.wallet.unlockCoin(outpoint); + await req.wallet.unlockCoin(outpoint); + res.send(200, { success: true }); }); // Wallet Coin