use req.wallet for lock coin endpoints

This commit is contained in:
Bucko 2017-09-18 18:55:44 -07:00
parent 7145d21c9c
commit e3ac717ada

View File

@ -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