Ivan Socolsky
8 years ago
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
2 changed files with
19 additions and
4 deletions
-
lib/server.js
-
test/integration/server.js
|
|
@ -1680,10 +1680,6 @@ WalletService.prototype._validateAndSanitizeTxOpts = function(wallet, opts, cb) |
|
|
|
|
|
|
|
async.series([ |
|
|
|
|
|
|
|
function(next) { |
|
|
|
if (!checkRequired(opts, ['outputs'], next)) return; |
|
|
|
next(); |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
// feePerKb is required unless inputs & fee are specified
|
|
|
|
if (!_.isNumber(opts.feePerKb) && !(opts.inputs && _.isNumber(opts.fee))) |
|
|
@ -1755,6 +1751,10 @@ WalletService.prototype._validateAndSanitizeTxOpts = function(wallet, opts, cb) |
|
|
|
WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
opts = opts || {}; |
|
|
|
|
|
|
|
if (!checkRequired(opts, ['outputs'], cb)) return; |
|
|
|
|
|
|
|
function getChangeAddress(wallet, cb) { |
|
|
|
if (wallet.singleAddress) { |
|
|
|
self.storage.fetchAddresses(self.walletId, function(err, addresses) { |
|
|
|
|
|
@ -2294,6 +2294,21 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('should fail to create a tx without outputs param', function(done) { |
|
|
|
helpers.stubUtxos(server, wallet, [1, 2], function() { |
|
|
|
var txOpts = { |
|
|
|
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', |
|
|
|
amount: 0.8 * 1e8, |
|
|
|
message: 'some message', |
|
|
|
feePerKb: 123e2, |
|
|
|
}; |
|
|
|
server.createTx(txOpts, function(err, tx) { |
|
|
|
should.exist(err); |
|
|
|
should.not.exist(tx); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('should be able to publish a temporary tx proposal', function(done) { |
|
|
|
helpers.stubUtxos(server, wallet, [1, 2], function() { |
|
|
|
var txOpts = { |
|
|
|