@@ -158,7 +158,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
158
158
description : data . stateParams . description ,
159
159
paypro : data . stateParams . paypro ,
160
160
161
- feeLevel : configFeeLevel ,
162
161
spendUnconfirmed : walletConfig . spendUnconfirmed ,
163
162
164
163
// Vanity tx info (not in the real tx)
@@ -175,11 +174,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
175
174
if ( data . stateParams . requiredFeeRate ) {
176
175
usingMerchantFee = true ;
177
176
tx . feeRate = parseInt ( data . stateParams . requiredFeeRate ) ;
177
+ } else {
178
+ tx . feeLevel = ( tx . coin && tx . coin == 'bch' ) ? 'normal ' : configFeeLevel ;
178
179
}
179
180
180
181
if ( tx . coin && tx . coin == 'bch' ) {
181
- tx . feeLevel = 'normal' ;
182
-
183
182
// Use legacy address
184
183
tx . toAddress = new bitcoreCash . Address ( tx . toAddress ) . toString ( ) ;
185
184
} ;
@@ -296,9 +295,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
296
295
return cb ( ) ;
297
296
}
298
297
299
- // Hack to get 'urgent' fee levels in case of merchantFees, to compare.
300
- feeService . getFeeRate ( wallet . coin , tx . network , usingMerchantFee ? 'urgent' : tx . feeLevel , function ( err , feeRate ) {
298
+ var maxAllowedMerchantFee = {
299
+ btc : 'urgent' ,
300
+ bch : 'normal' ,
301
+ } ;
302
+
303
+ feeService . getFeeRate ( wallet . coin , tx . network , usingMerchantFee ? maxAllowedMerchantFee [ wallet . coin ] : tx . feeLevel , function ( err , feeRate ) {
301
304
if ( err ) {
305
+ $log . warn ( err ) ;
302
306
ongoingProcess . set ( 'calculatingFee' , false ) ;
303
307
return cb ( err ) ;
304
308
}
@@ -309,8 +313,9 @@ angular.module('copayApp.controllers').controller('confirmController', function(
309
313
tx . feeLevelName = msg ;
310
314
} else if ( usingMerchantFee ) {
311
315
312
- $log . info ( 'Using Merchant Fee:' + tx . feeRate + ' vs. Urgent level:' + feeRate ) ;
313
- if ( tx . feeRate > feeRate ) {
316
+ var maxAllowedfee = feeRate * 2 ;
317
+ $log . info ( 'Using Merchant Fee:' + tx . feeRate + ' vs. referent level:' + maxAllowedfee ) ;
318
+ if ( tx . feeRate > maxAllowedfee ) {
314
319
ongoingProcess . set ( 'calculatingFee' , false ) ;
315
320
setNoWallet ( gettextCatalog . getString ( 'Merchant fee to high. Payment rejected' ) , true ) ;
316
321
return cb ( 'fee_too_high' ) ;
@@ -525,11 +530,10 @@ angular.module('copayApp.controllers').controller('confirmController', function(
525
530
// If select another wallet
526
531
tx . coin = wallet . coin ;
527
532
528
- if ( usingCustomFee ) {
533
+ if ( usingCustomFee || usingMerchantFee ) {
529
534
} else {
530
535
tx . feeLevel = wallet . coin == 'bch' ? 'normal' : configFeeLevel ;
531
536
}
532
-
533
537
setButtonText ( wallet . credentials . m > 1 , ! ! tx . paypro ) ;
534
538
535
539
if ( tx . paypro )
0 commit comments