 
   is_good_input_tx : (tx) ->
     amt = tx.amount * SATOSHI_PER_BTC
-    (tx.address is @from_address()) and 
-      (amt >= @min_amount()) and (amt <= @max_amount()) and
-      (tx.confirmations >= @min_confirmations())
+    if (tx.address is @from_address()) and 
+         (amt >= @min_amount()) and (amt <= @max_amount()) and
+         (tx.confirmations >= @min_confirmations())
+      ret = amt - @min_amount()
+    else
+      ret = null
 
   #-----------------------------------
 
   find_transaction : (cb) ->
     esc = make_esc cb, "Runner::find_transaction"
-    await @cli.listUnspent esc defer txs
+    await @client.listUnspent esc defer txs
+    best_tx = null
+    best_waste = null
     for tx in txs
-      if @is_good_input_tx tx
-        @input_tx = tx
-        break
-    if not @input_tx?
+      if not (waste = @is_good_input_tx(tx))? then # noop
+      else if not(best_waste?) or waste < best_waste
+        best_tx = tx
+        best_waste = waste
+    if best_tx?
+      @input_tx = best_tx
+    else
       err = new Error "Couldn't find spendable input transaction"
+    cb err
+
+  #-----------------------------------
+
+  check_args : (cb) ->
+    err = null
+    if not @from_address()? then err = new Error "no from address to work with"
     cb err
 
   #-----------------------------------


  #-----------------------------------

  amount     : () -> @cfg('amount') or (btcjs.networks.bitcoin.dustThreshold+1)
  min_amount : () -> @amount() + btcjs.networks.bitcoin.feePerKb
  max_amount : () -> 2*btcjs.networks.bitcion.feePerKb
  min_confirmations : () -> @cfg('confirmations') or 3

  #-----------------------------------


      alias :
        c : 'config'
        d : 'data'
        f : 'from-address'
        a : 'amount'
        l : 'data-log'
        b : 'bitcoin-config'
