mirror of https://github.com/BTCPrivate/copay.git
inform the user of "too big" tx
This commit is contained in:
parent
1f9b9c8dca
commit
4821567b1d
|
@ -77,8 +77,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
$scope.submitForm = function(form) {
|
||||
if (form.$invalid) {
|
||||
var message = 'Unable to send transaction proposal';
|
||||
notification.error('Error', message);
|
||||
$scope.error = 'Unable to send transaction proposal';
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,8 +89,15 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
function done(err, ntxid, merchantData) {
|
||||
if (err) {
|
||||
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') + ' could not be created';
|
||||
notification.error('Error', message);
|
||||
copay.logger.error(err);
|
||||
|
||||
var msg = err.toString();
|
||||
|
||||
if (msg.match('BIG'))
|
||||
msg = 'The transaction have too many inputs. Try creating many transactions for smaller amounts.'
|
||||
|
||||
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') + ' could not be created: ' + msg;
|
||||
$scope.error = message;
|
||||
$scope.loading = false;
|
||||
$scope.loadTxs();
|
||||
return;
|
||||
|
@ -135,7 +141,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}
|
||||
notification.success('Transaction broadcasted', message);
|
||||
} else {
|
||||
notification.error('Error', 'There was an error sending the transaction');
|
||||
$scope.error = 'There was an error sending the transaction';
|
||||
}
|
||||
$scope.loading = false;
|
||||
$scope.loadTxs();
|
||||
|
@ -374,10 +380,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
// Each signature takes
|
||||
var estimatedFee = copay.Wallet.estimatedFee($rootScope.safeUnspentCount);
|
||||
console.log('[send.js.376:estimatedFee:]',estimatedFee); //TODO
|
||||
var amount = ((($rootScope.availableBalance * w.settings.unitToSatoshi).toFixed(0) - estimatedFee) / w.settings.unitToSatoshi);
|
||||
|
||||
console.log('[send.js.402:amount:]',amount); //TODO
|
||||
return amount > 0 ? amount : 0;
|
||||
};
|
||||
|
||||
|
@ -391,7 +395,7 @@ console.log('[send.js.402:amount:]',amount); //TODO
|
|||
$rootScope.txAlertCount = 0;
|
||||
w.sendTx(ntxid, function(txid, merchantData) {
|
||||
if (!txid) {
|
||||
notification.error('Error', 'There was an error sending the transaction');
|
||||
$scope.error = 'There was an error sending the transaction';
|
||||
} else {
|
||||
if (!merchantData) {
|
||||
notification.success('Transaction broadcasted', 'Transaction id: ' + txid);
|
||||
|
@ -415,7 +419,7 @@ console.log('[send.js.402:amount:]',amount); //TODO
|
|||
$scope.loading = true;
|
||||
w.sign(ntxid, function(ret) {
|
||||
if (!ret) {
|
||||
notification.error('Error', 'There was an error signing the transaction');
|
||||
$scope.error = 'There was an error signing the transaction';
|
||||
$scope.loadTxs();
|
||||
} else {
|
||||
var p = w.txProposals.getTxProposal(ntxid);
|
||||
|
|
|
@ -30,8 +30,8 @@ var Async = require('./Async');
|
|||
var Insight = module.exports.Insight = require('./Insight');
|
||||
var copayConfig = require('../../config');
|
||||
|
||||
var TX_MAX_SIZE_KB = 60;
|
||||
var TX_MAX_INS = 100;
|
||||
var TX_MAX_SIZE_KB = 50;
|
||||
var TX_MAX_INS = 70;
|
||||
/**
|
||||
* @desc
|
||||
* Wallet manages a private key for Copay, network, storage of the wallet for
|
||||
|
@ -2337,6 +2337,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb)
|
|||
ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts);
|
||||
log.debub('TX Created: ntxid', ntxid); //TODO
|
||||
} catch (e) {
|
||||
console.log('[Wallet.js.2340]', e); //TODO
|
||||
return cb(e);
|
||||
}
|
||||
|
||||
|
@ -2384,7 +2385,6 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos
|
|||
opts[k] = Wallet.builderOpts[k];
|
||||
}
|
||||
|
||||
console.log('[Wallet.js.2386]'); //TODO
|
||||
var b = new Builder(opts)
|
||||
.setUnspent(utxos)
|
||||
.setOutputs([{
|
||||
|
@ -2395,10 +2395,9 @@ console.log('[Wallet.js.2386]'); //TODO
|
|||
log.debug('Creating TX: Builder ready');
|
||||
|
||||
var selectedUtxos = b.getSelectedUnspent();
|
||||
console.log('[Wallet.js.2397:selectedUtxos:]',selectedUtxos); //TODO
|
||||
|
||||
if (selectedUtxos.size > TX_MAX_INS)
|
||||
throw new Error('BIG: Resulting TX is too big:' + selectedUtxos.size + ' inputs. Aborting');
|
||||
if (selectedUtxos.length > TX_MAX_INS)
|
||||
throw new Error('BIG: Resulting TX is too big:' + selectedUtxos.length + ' inputs. Aborting');
|
||||
|
||||
|
||||
var inputChainPaths = selectedUtxos.map(function(utxo) {
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
<div class="row collapse m0">
|
||||
<div class="large-6 columns">
|
||||
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
|
||||
<p class="text-warning size-12"
|
||||
ng-show="error">
|
||||
<i class="fi-x"></i>
|
||||
{{error|translate}}
|
||||
</p>
|
||||
|
||||
<div class="row collapse">
|
||||
<div class="large-12 columns">
|
||||
<div class="row collapse">
|
||||
|
|
Loading…
Reference in New Issue