Browse Source

Merge pull request #456 from isocolsky/ref/proposal-flow

Test fee arguments on new proposal flow + v1.5.0
activeAddress
Matias Alejo Garcia 9 years ago
parent
commit
65a6ce4e8a
  1. 2
      lib/server.js
  2. 2
      package.json
  3. 18
      test/integration/server.js

2
lib/server.js

@ -1553,6 +1553,8 @@ WalletService.prototype.createTx = function(opts, cb) {
return cb(new ClientError('Required argument missing'));
if (_.isNumber(opts.fee)) {
if (_.isNumber(opts.feePerKb))
return cb(new ClientError('Cannot sepcify both fee and feePerKb arguments'));
opts.feePerKb = null;
if (opts.fee < Defaults.MIN_TX_FEE || opts.fee > Defaults.MAX_TX_FEE)
return cb(new ClientError('Invalid fee'));

2
package.json

@ -2,7 +2,7 @@
"name": "bitcore-wallet-service",
"description": "A service for Mutisig HD Bitcoin Wallets",
"author": "BitPay Inc",
"version": "1.4.0",
"version": "1.5.0",
"keywords": [
"bitcoin",
"copay",

18
test/integration/server.js

@ -2742,6 +2742,24 @@ describe('Wallet service', function() {
});
});
it('should not be able to specify both final fee & fee per kb', function(done) {
helpers.stubUtxos(server, wallet, [1, 2], function() {
var txOpts = {
outputs: [{
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
amount: 0.8 * 1e8,
}],
fee: 123400,
feePerKb: 123400,
};
server.createTx(txOpts, function(err, tx) {
should.exist(err);
err.message.should.contain('fee');
done();
});
});
});
it('should check explicit fee to be below max', function(done) {
helpers.stubUtxos(server, wallet, [1, 2], function() {
var txOpts = {

Loading…
Cancel
Save