http: fix broadcast call.

This commit is contained in:
Christopher Jeffrey 2017-06-26 21:29:24 -07:00
parent 33c4ede940
commit 8b74d95280
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -316,9 +316,15 @@ HTTPServer.prototype.initRouter = function initRouter() {
// Broadcast TX
this.post('/broadcast', async function(req, res) {
var valid = req.valid();
var tx = valid.buf('tx');
enforce(tx, 'TX is required.');
var raw = valid.buf('tx');
var tx;
enforce(raw, 'TX is required.');
tx = TX.fromRaw(raw);
await this.node.sendTX(tx);
res.send(200, { success: true });
});