@@ -2326,18 +2326,18 @@ describe('Wallet service', function() {
2326
2326
2327
2327
it ( 'should be possible to use a smaller fee' , function ( done ) {
2328
2328
helpers . stubUtxos ( server , wallet , 1 , function ( ) {
2329
- var txOpts = helpers . createSimpleProposalOpts ( '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7' , 0.99995 , TestData . copayers [ 0 ] . privKey_1H_0 , {
2329
+ var txOpts = helpers . createSimpleProposalOpts ( '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7' , 0.9999 , TestData . copayers [ 0 ] . privKey_1H_0 , {
2330
2330
feePerKb : 80000
2331
2331
} ) ;
2332
2332
server . createTxLegacy ( txOpts , function ( err , tx ) {
2333
2333
should . exist ( err ) ;
2334
2334
err . code . should . equal ( 'INSUFFICIENT_FUNDS_FOR_FEE' ) ;
2335
- var txOpts = helpers . createSimpleProposalOpts ( '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7' , 0.99995 , TestData . copayers [ 0 ] . privKey_1H_0 , {
2335
+ var txOpts = helpers . createSimpleProposalOpts ( '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7' , 0.9999 , TestData . copayers [ 0 ] . privKey_1H_0 , {
2336
2336
feePerKb : 5000
2337
2337
} ) ;
2338
2338
server . createTxLegacy ( txOpts , function ( err , tx ) {
2339
2339
should . not . exist ( err ) ;
2340
- var estimatedFee = 5000 * 400 / 1000 ; // fully signed tx should have about 400 bytes
2340
+ var estimatedFee = 5000 * 410 / 1000 ; // fully signed tx should have about 410 bytes
2341
2341
tx . fee . should . be . within ( 0.9 * estimatedFee , 1.1 * estimatedFee ) ;
2342
2342
2343
2343
// Sign it to make sure Bitcore doesn't complain about the fees
@@ -3597,17 +3597,18 @@ describe('Wallet service', function() {
3597
3597
} ) ;
3598
3598
} ) ;
3599
3599
} ) ;
3600
- it ( 'should correct fee if resulting change would be below dust ' , function ( done ) {
3600
+ it ( 'should correct fee if resulting change would be below threshold ' , function ( done ) {
3601
3601
helpers . stubUtxos ( server , wallet , [ '200bit' , '500sat' ] , function ( ) {
3602
3602
var txOpts = {
3603
3603
outputs : [ {
3604
3604
toAddress : '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7' ,
3605
- amount : 200e2 ,
3605
+ amount : 150e2 ,
3606
3606
} ] ,
3607
- feePerKb : 400 ,
3607
+ feePerKb : 100e2 ,
3608
3608
} ;
3609
3609
server . createTx ( txOpts , function ( err , txp ) {
3610
3610
should . not . exist ( err ) ;
3611
+ txp . inputs . length . should . equal ( 1 ) ;
3611
3612
( _ . sum ( txp . inputs , 'satoshis' ) - txp . outputs [ 0 ] . amount - txp . fee ) . should . equal ( 0 ) ;
3612
3613
var changeOutput = txp . getBitcoreTx ( ) . getChangeOutput ( ) ;
3613
3614
should . not . exist ( changeOutput ) ;
0 commit comments