diff --git a/lib/server.js b/lib/server.js index 255acd4..c26411d 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1593,7 +1593,8 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) { var err = self._checkTx(txp); if (!err) { - log.debug('Successfully built transaction. Total fees: ' + Utils.formatAmountInBtc(txp.fee) + ', total change: ' + Utils.formatAmountInBtc(_.sum(txp.inputs, 'satoshis') - txp.fee)); + var change = _.sum(txp.inputs, 'satoshis') - _.sum(txp.outputs, 'amount') - txp.fee; + log.debug('Successfully built transaction. Total fees: ' + Utils.formatAmountInBtc(txp.fee) + ', total change: ' + Utils.formatAmountInBtc(change)); } else { log.warn('Error building transaction', err); } diff --git a/test/integration/server.js b/test/integration/server.js index ffaef48..c6a051d 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2132,7 +2132,6 @@ describe('Wallet service', function() { }); it('should use unconfirmed utxos only when no more confirmed utxos are available', function(done) { - // log.level = 'debug'; helpers.stubUtxos(server, wallet, [1.3, 'u0.5', 'u0.1', 1.2], function(utxos) { var txOpts = helpers.createSimpleProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 2.55, TestData.copayers[0].privKey_1H_0, { message: 'some message' @@ -2355,7 +2354,6 @@ describe('Wallet service', function() { }); it('should fail to create a tx exceeding max size in kb', function(done) { - // log.level = 'debug'; var _oldDefault = Defaults.MAX_TX_SIZE_IN_KB; Defaults.MAX_TX_SIZE_IN_KB = 1; helpers.stubUtxos(server, wallet, _.range(1, 10, 0), function() { @@ -3399,7 +3397,6 @@ describe('Wallet service', function() { }); }); it('should account for fee when selecting smallest big utxo', function(done) { - // log.level = 'debug'; var _old = Defaults.UTXO_SELECTION_MAX_SINGLE_UTXO_FACTOR; Defaults.UTXO_SELECTION_MAX_SINGLE_UTXO_FACTOR = 2; // The 605 bits input cannot be selected even if it is > 2 * tx amount @@ -3564,7 +3561,6 @@ describe('Wallet service', function() { }); }); it('should select unconfirmed utxos if not enough confirmed utxos', function(done) { - // log.level = 'debug'; helpers.stubUtxos(server, wallet, ['u 1btc', '0.5btc'], function() { var txOpts = { outputs: [{