From d58bfe9de88be727ba4d61be6752665c49216112 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 6 Aug 2014 23:02:31 -0700 Subject: [PATCH] paypro: comment for handling 0-amount outputs from server. --- js/controllers/send.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index 7f5f15a89..08a1dcac3 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -62,13 +62,19 @@ angular.module('copayApp.controllers').controller('SendController', var w = $rootScope.wallet; function done(ntxid, merchantData) { + // If user is granted the privilege of choosing + // their own amount, add it to the tx. if (merchantData && +merchantData.total === 0) { var txp = w.txProposals.get(ntxid); - txp.builder.tx.outs[0].v = bitcore.Bignum(amount + '', 10).toBuffer({ + var tx = txp.builder.tx = txp.builder.tx || txp.builder.build(); + tx.outs[0].v = bitcore.Bignum(amount + '', 10).toBuffer({ + // XXX This may not work in node due + // to the bignum only-big endian bug: endian: 'little', size: 1 }); } + if (w.isShared()) { $scope.loading = false; var message = 'The transaction proposal has been created';