|
@ -3429,6 +3429,8 @@ describe('Wallet service', function() { |
|
|
|
|
|
|
|
|
describe('#broadcastTx & #broadcastRawTx', function() { |
|
|
describe('#broadcastTx & #broadcastRawTx', function() { |
|
|
var server, wallet, txpid, txid; |
|
|
var server, wallet, txpid, txid; |
|
|
|
|
|
describe('Legacy', function() { |
|
|
|
|
|
|
|
|
beforeEach(function(done) { |
|
|
beforeEach(function(done) { |
|
|
helpers.createAndJoinWallet(1, 1, function(s, w) { |
|
|
helpers.createAndJoinWallet(1, 1, function(s, w) { |
|
|
server = s; |
|
|
server = s; |
|
@ -3547,10 +3549,6 @@ describe('Wallet service', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should fail to brodcast a not yet accepted tx', function(done) { |
|
|
it('should fail to brodcast a not yet accepted tx', function(done) { |
|
|
helpers.stubBroadcast(); |
|
|
helpers.stubBroadcast(); |
|
|
var txOpts = helpers.createSimpleProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 9, TestData.copayers[0].privKey_1H_0, { |
|
|
var txOpts = helpers.createSimpleProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 9, TestData.copayers[0].privKey_1H_0, { |
|
@ -3633,6 +3631,63 @@ describe('Wallet service', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('New', function() { |
|
|
|
|
|
beforeEach(function(done) { |
|
|
|
|
|
helpers.createAndJoinWallet(1, 1, function(s, w) { |
|
|
|
|
|
server = s; |
|
|
|
|
|
wallet = w; |
|
|
|
|
|
helpers.stubUtxos(server, wallet, [10, 10], function() { |
|
|
|
|
|
var txOpts = { |
|
|
|
|
|
outputs: [{ |
|
|
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
|
|
amount: 9e8, |
|
|
|
|
|
}], |
|
|
|
|
|
message: 'some message', |
|
|
|
|
|
}; |
|
|
|
|
|
helpers.createAndPublishTx(server, txOpts, TestData.copayers[0].privKey_1H_0, function(txp) { |
|
|
|
|
|
should.exist(txp); |
|
|
|
|
|
var signatures = helpers.clientSign(txp, TestData.copayers[0].xPrivKey_44H_0H_0H); |
|
|
|
|
|
server.signTx({ |
|
|
|
|
|
txProposalId: txp.id, |
|
|
|
|
|
signatures: signatures, |
|
|
|
|
|
}, function(err, txp) { |
|
|
|
|
|
should.not.exist(err); |
|
|
|
|
|
should.exist(txp); |
|
|
|
|
|
txp.isAccepted().should.be.true; |
|
|
|
|
|
txp.isBroadcasted().should.be.false; |
|
|
|
|
|
txid = txp.txid; |
|
|
|
|
|
txpid = txp.id; |
|
|
|
|
|
done(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('should broadcast a tx', function(done) { |
|
|
|
|
|
var clock = sinon.useFakeTimers(1234000, 'Date'); |
|
|
|
|
|
helpers.stubBroadcast(); |
|
|
|
|
|
server.broadcastTx({ |
|
|
|
|
|
txProposalId: txpid |
|
|
|
|
|
}, function(err) { |
|
|
|
|
|
should.not.exist(err); |
|
|
|
|
|
server.getTx({ |
|
|
|
|
|
txProposalId: txpid |
|
|
|
|
|
}, function(err, txp) { |
|
|
|
|
|
should.not.exist(err); |
|
|
|
|
|
should.not.exist(txp.raw); |
|
|
|
|
|
txp.txid.should.equal(txid); |
|
|
|
|
|
txp.isBroadcasted().should.be.true; |
|
|
|
|
|
txp.broadcastedOn.should.equal(1234); |
|
|
|
|
|
clock.restore(); |
|
|
|
|
|
done(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
describe('Tx proposal workflow', function() { |
|
|
describe('Tx proposal workflow', function() { |
|
|
var server, wallet; |
|
|
var server, wallet; |
|
|
beforeEach(function(done) { |
|
|
beforeEach(function(done) { |
|
|