|
|
@ -1662,7 +1662,7 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should create tx for type multiple_outputs', function(done) { |
|
|
|
xit('should create tx for type multiple_outputs', function(done) { |
|
|
|
helpers.stubUtxos(server, wallet, [100, 200], function() { |
|
|
|
var outputs = [ |
|
|
|
{ toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', amount: 75, message: 'message #1' }, |
|
|
@ -1677,7 +1677,7 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should fail to create tx for type multiple_outputs with invalid output argument', function(done) { |
|
|
|
xit('should fail to create tx for type multiple_outputs with invalid output argument', function(done) { |
|
|
|
helpers.stubUtxos(server, wallet, [100, 200], function() { |
|
|
|
var outputs = [ |
|
|
|
{ toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', amount: 80, message: 'message #1', foo: 'bar' }, |
|
|
@ -1692,7 +1692,7 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should fail to create tx for unsupported proposal type', function(done) { |
|
|
|
xit('should fail to create tx for unsupported proposal type', function(done) { |
|
|
|
helpers.stubUtxos(server, wallet, [100, 200], function() { |
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 80, 'some message', TestData.copayers[0].privKey_1H_0); |
|
|
|
txOpts.type = 'bogus'; |
|
|
@ -1770,17 +1770,12 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
|
|
|
|
it('should follow backoff time after consecutive rejections', function(done) { |
|
|
|
function logTime(i, j) { |
|
|
|
console.log('createTx backoff ' + i + ' ' + j + ' ' + (Date.now())); |
|
|
|
}; |
|
|
|
async.series([ |
|
|
|
|
|
|
|
function(next) { |
|
|
|
async.each(_.range(3), function(i, next) { |
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); |
|
|
|
logTime('' + (i + 1), 'a'); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
logTime('' + (i + 1), 'b'); |
|
|
|
should.not.exist(err); |
|
|
|
server.rejectTx({ |
|
|
|
txProposalId: tx.id, |
|
|
@ -1793,9 +1788,7 @@ describe('Wallet service', function() { |
|
|
|
function(next) { |
|
|
|
// Allow a 4th tx
|
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); |
|
|
|
logTime('4', 'a'); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
logTime('4', 'b'); |
|
|
|
server.rejectTx({ |
|
|
|
txProposalId: tx.id, |
|
|
|
reason: 'some reason', |
|
|
@ -1805,24 +1798,17 @@ describe('Wallet service', function() { |
|
|
|
function(next) { |
|
|
|
// Do not allow before backoff time
|
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); |
|
|
|
logTime('5a', 'b'); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
logTime('5a', 'b'); |
|
|
|
should.exist(err); |
|
|
|
err.code.should.equal('NOTALLOWEDTOCREATETX'); |
|
|
|
next(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
logTime('5', 'a'); |
|
|
|
var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000); |
|
|
|
logTime('5', 'b'); |
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); |
|
|
|
logTime('5', 'c'); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
logTime('5', 'd'); |
|
|
|
clock.restore(); |
|
|
|
logTime('5', 'e'); |
|
|
|
server.rejectTx({ |
|
|
|
txProposalId: tx.id, |
|
|
|
reason: 'some reason', |
|
|
@ -1831,15 +1817,10 @@ describe('Wallet service', function() { |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
// Do not allow a 5th tx before backoff time
|
|
|
|
logTime('6', 'a'); |
|
|
|
var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000 + 1); |
|
|
|
logTime('6', 'b'); |
|
|
|
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); |
|
|
|
logTime('6', 'c'); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
logTime('6', 'd'); |
|
|
|
clock.restore(); |
|
|
|
logTime('6', 'e'); |
|
|
|
should.exist(err); |
|
|
|
err.code.should.equal('NOTALLOWEDTOCREATETX'); |
|
|
|
next(); |
|
|
|