fix broadcasting

This commit is contained in:
Matias Alejo Garcia 2015-02-15 19:12:45 -03:00
parent 7c1860117e
commit 3b0d95b690
5 changed files with 14 additions and 3 deletions

3
app.js
View File

@ -199,6 +199,7 @@ router.post('/v1/txproposals/:id/signatures/', function(req, res) {
req.body.txProposalId = req.params['id'];
server.signTx(req.body, function(err, txp) {
if (err) return returnError(err, res, req);
res.json(txp);
res.end();
});
});
@ -210,6 +211,7 @@ router.post('/v1/txproposals/:id/broadcast/', function(req, res) {
req.body.txProposalId = req.params['id'];
server.broadcastTx(req.body, function(err, txp) {
if (err) return returnError(err, res, req);
res.json(txp);
res.end();
});
});
@ -220,6 +222,7 @@ router.post('/v1/txproposals/:id/rejections', function(req, res) {
req.body.txProposalId = req.params['id'];
server.rejectTx(req.body, function(err, txp) {
if (err) return returnError(err, res, req);
res.json(txp);
res.end();
});
});

View File

@ -25,6 +25,7 @@ client.getTxProposals({}, function(err, txps) {
var txp = utils.findOneTxProposal(txps, txpid);
client.broadcastTxProposal(txp, function(err, txid) {
utils.die(err);
console.log('TX Broadcasted: ', txid);
console.log('Transaction Broadcasted: TXID: ' + x.txid);
});
});

View File

@ -23,6 +23,9 @@ client.getTxProposals({}, function(err, txps) {
var txp = utils.findOneTxProposal(txps, txpid);
client.rejectTxProposal(txp, reason, function(err, tx) {
utils.die(err);
console.log('Transaction rejected.');
if (x.status == 'rejected')
console.log('Transaction finally rejected.');
else
console.log('Transaction rejected by you.');
});
});

View File

@ -21,6 +21,9 @@ client.getTxProposals({}, function(err, txps) {
var txp = utils.findOneTxProposal(txps, txpid);
client.signTxProposal(txp, function(err, x) {
utils.die(err);
console.log('Transaction signed.');
if (x.status == 'broadcasted')
console.log('Transaction Broadcasted: TXID: ' + x.txid);
else
console.log('Transaction signed by you.');
});
});

View File

@ -650,6 +650,7 @@ CopayServer.prototype.signTx = function(opts, cb) {
txid: txid
});
console.log('[server.js.653:txp:]',txp); //TODO
return cb(null, txp);
});
});