 
   is_good_input_tx : (tx) ->
     amt = tx.amount * SATOSHI_PER_BTC
-    diff = amt - @tx_rough_total
-    if (diff > 0) and (tx.account is account())
+    diff = amt - @tx_rough_total()
+    if (diff > 0) and (tx.account is @account()) and (tx.confirmations >= @min_confirmations())
       ret = -diff # We want the transaction with the most wiggle room, not the least...
     else
       ret = null
+    return ret
 
   #-----------------------------------
 

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

  submit_transaction : (cb) ->
    #await @client.sendRawTransaction @out_tx.toHex(), defer err, @out_tx_id
    console.log @out_tx.toHex()
    cb err

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


  make_transaction : (cb) ->
    err = null
    tx = new btcjs.Transaction
    tx.addInput @input_tx.txid, @input_tx.vout
    num = @num_outputs()
    for i in [0...num]
      tx.addOutput @to_address(), @min_amount()
    skey = btcjs.ECKey.fromWIF @priv_key

    # Sign temporarily with a fictitious amount of change
