|
|
@ -201,6 +201,12 @@ helpers.clientSign = function(tx, xpriv, n) { |
|
|
|
return signatures; |
|
|
|
}; |
|
|
|
|
|
|
|
helpers.addProposalSignature = function(server, wallet, txOpts) { |
|
|
|
var msg = txOpts.toAddress + '|' + txOpts.amount + '|' + txOpts.message; |
|
|
|
var copayer = wallet.getCopayer(server.copayerId); |
|
|
|
txOpts.proposalSignature = SignUtils.sign(msg, copayer.signingPubKey); |
|
|
|
}; |
|
|
|
|
|
|
|
var db, storage; |
|
|
|
|
|
|
|
|
|
|
@ -596,7 +602,7 @@ describe('Copay server', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should create a tx', function(done) { |
|
|
|
it.only('should create a tx', function(done) { |
|
|
|
helpers.createUtxos(server, wallet, helpers.toSatoshi([100, 200]), function(utxos) { |
|
|
|
helpers.stubBlockExplorer(server, utxos); |
|
|
|
var txOpts = { |
|
|
@ -604,8 +610,10 @@ describe('Copay server', function() { |
|
|
|
amount: helpers.toSatoshi(80), |
|
|
|
message: 'some message', |
|
|
|
}; |
|
|
|
|
|
|
|
helpers.addProposalSignature(txOpts, ); |
|
|
|
console.log(txOpts); |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
console.log(err); |
|
|
|
should.not.exist(err); |
|
|
|
tx.should.exist; |
|
|
|
tx.message.should.equal('some message'); |
|
|
@ -647,6 +655,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(80), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
should.not.exist(tx); |
|
|
@ -665,6 +674,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: 'invalid address', |
|
|
|
amount: helpers.toSatoshi(80), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
|
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
@ -683,6 +693,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: 'myE38JHdxmQcTJGP1ZiX4BiGhDxMJDvLJD', // testnet
|
|
|
|
amount: helpers.toSatoshi(80), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
|
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
@ -701,6 +712,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(120), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
|
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
@ -730,6 +742,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(12), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
should.not.exist(err); |
|
|
@ -738,6 +751,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts2 = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: 8, |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts2, function(err, tx) { |
|
|
|
should.not.exist(err); |
|
|
@ -763,6 +777,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(12), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
should.not.exist(err); |
|
|
@ -771,6 +786,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts2 = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(24), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts2, function(err, tx) { |
|
|
|
err.code.should.equal('INSUFFICIENTFUNDS'); |
|
|
@ -805,6 +821,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(80), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
async.map(_.range(N), function(i, cb) { |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
@ -841,6 +858,7 @@ describe('Copay server', function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(10), |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
should.not.exist(err); |
|
|
@ -1004,6 +1022,7 @@ describe('Copay server', function() { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: helpers.toSatoshi(10), |
|
|
|
message: 'some message', |
|
|
|
proposalSignature: 'dummy', |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, txp) { |
|
|
|
should.not.exist(err); |
|
|
|