mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #3689 from cmgustavo/bug/multiple-outputs
Fixes proposals with multiple outputs with only one output
This commit is contained in:
commit
0f57f489e2
|
@ -495,6 +495,25 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.pendingTxProposalsCountForUs = 0;
|
||||
var now = Math.floor(Date.now() / 1000);
|
||||
|
||||
/* Uncomment to test multiple outputs */
|
||||
/*
|
||||
var txp = {
|
||||
message: 'test multi-output',
|
||||
fee: 1000,
|
||||
createdOn: new Date() / 1000,
|
||||
outputs: []
|
||||
};
|
||||
function addOutput(n) {
|
||||
txp.outputs.push({
|
||||
amount: 600,
|
||||
toAddress: '2N8bhEwbKtMvR2jqMRcTCQqzHP6zXGToXcK',
|
||||
message: 'output #' + (Number(n) + 1)
|
||||
});
|
||||
};
|
||||
lodash.times(150, addOutput);
|
||||
txps.push(txp);
|
||||
*/
|
||||
|
||||
lodash.each(txps, function(tx) {
|
||||
|
||||
tx = txFormatService.processTx(tx);
|
||||
|
|
|
@ -24,10 +24,9 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS
|
|||
root.processTx = function(tx) {
|
||||
if (!tx) return;
|
||||
|
||||
var outputs = tx.outputs ? tx.outputs.length : 0;
|
||||
if (outputs > 1 && tx.action != 'received') {
|
||||
if (lodash.isArray(tx.outputs) && tx.outputs.length > 0 && tx.action != 'received') {
|
||||
tx.hasMultiplesOutputs = true;
|
||||
tx.recipientCount = outputs;
|
||||
tx.recipientCount = tx.outputs.length;
|
||||
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
|
||||
o.amountStr = formatAmountStr(o.amount);
|
||||
o.alternativeAmountStr = formatAlternativeStr(o.amount);
|
||||
|
|
Loading…
Reference in New Issue