commit
76e98d6e87
6 changed files with 614 additions and 44133 deletions
|
|
@ -197,8 +197,8 @@ Insight.prototype.broadcast = function(rawtx, cb) {
|
|||
this.requestPost('/api/tx/send', {
|
||||
rawtx: rawtx
|
||||
}, function(err, res, body) {
|
||||
if (err || res.statusCode != 200) cb(err || res);
|
||||
cb(null, body.txid);
|
||||
if (err || res.status != 200) cb(err || res);
|
||||
cb(null, body ? body.txid: null);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ var Script = bitcore.Script;
|
|||
var Key = bitcore.Key;
|
||||
var buffertools = bitcore.buffertools;
|
||||
var preconditions = require('preconditions').instance();
|
||||
var log = require('../log');
|
||||
|
||||
function TxProposals(opts) {
|
||||
opts = opts || {};
|
||||
|
|
@ -27,11 +28,16 @@ TxProposals.fromObj = function(o, forceOpts) {
|
|||
});
|
||||
|
||||
o.txps.forEach(function(o2) {
|
||||
var t = TxProposal.fromObj(o2, forceOpts);
|
||||
if (t.builder) {
|
||||
try {
|
||||
var t = TxProposal.fromObj(o2, forceOpts);
|
||||
} catch (e) {
|
||||
log.info('Ignoring corrupted TxProposal:', o2, e);
|
||||
}
|
||||
if (t && t.builder) {
|
||||
var id = t.getId();
|
||||
ret.txps[id] = t;
|
||||
}
|
||||
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ Wallet.prototype._checkSentTx = function(ntxid, cb) {
|
|||
|
||||
this.blockchain.getTransaction(txid, function(err, tx) {
|
||||
if (err) return cb(false);
|
||||
cb(ret);
|
||||
return cb(ret);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
44497
lib/bitcore.js
44497
lib/bitcore.js
File diff suppressed because one or more lines are too long
|
|
@ -40,12 +40,14 @@ describe('TxProposals', function() {
|
|||
should.exist(txps);
|
||||
txps.network.name.should.equal('livenet');
|
||||
});
|
||||
it('should fail create an instance from an Object with errors', function() {
|
||||
(function() {var txps = TxProposals.fromObj({
|
||||
it('should skip Objects with errors', function() {
|
||||
var txps = TxProposals.fromObj({
|
||||
networkName:'livenet',
|
||||
walletId: '123a12',
|
||||
txps: [ { a: 1 }],
|
||||
}) }).should.throw('Illegal');
|
||||
});
|
||||
should.exist(txps);
|
||||
Object.keys(txps.txps).length.should.equal(0);
|
||||
});
|
||||
});
|
||||
describe('#getNtxids', function() {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ describe('Insight model', function() {
|
|||
|
||||
sinon.stub(blockchain, "requestPost", function(url, data, cb) {
|
||||
url.should.be.equal('/api/tx/send');
|
||||
var res = {statusCode: 200};
|
||||
var res = {status: 200};
|
||||
var body = {txid: 1234};
|
||||
setTimeout(function() {
|
||||
cb(null, res, body);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue