URI:
       tGracefully handle the failure to find an input UTXO - electrum-personal-server - Maximally lightweight electrum server for a single user
  HTML git clone https://git.parazyd.org/electrum-personal-server
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit 8338b0883b78bdbb36af1d9d2d01faf11c9312aa
   DIR parent 9905d94ac900f47f9a7ed847d4520472b5838391
  HTML Author: chris-belcher <chris-belcher@users.noreply.github.com>
       Date:   Mon, 21 May 2018 20:38:09 +0100
       
       Gracefully handle the failure to find an input UTXO
       
       generate_new_history_element() will now also check `getrawtransaction`
       for an input UTXO and wont crash if even that isn't found.
       
       Diffstat:
         M electrumpersonalserver/transaction… |      21 ++++++++++++++-------
       
       1 file changed, 14 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/electrumpersonalserver/transactionmonitor.py b/electrumpersonalserver/transactionmonitor.py
       t@@ -208,14 +208,21 @@ class TransactionMonitor(object):
                            utxo = self.rpc.call("gettxout", [inn["txid"], inn["vout"],
                                False])
                            if utxo is None:
       -                        self.debug("utxo not found(!)")
       -                        #TODO detect this and figure out how to tell
       -                        # electrum that we dont know the fee
       -                total_input_value += int(Decimal(utxo["value"]) * Decimal(1e8))
       -                unconfirmed_input = (unconfirmed_input or
       -                    utxo["confirmations"] == 0)
       -            self.debug("total_input_value = " + str(total_input_value))
       +                        rawtx = self.rpc.call("getrawtransaction", [inn["txid"],
       +                            True])
       +                        if rawtx is not None:
       +                            utxo = {"confirmations": rawtx["confirmations"],
       +                                "value": rawtx["vout"][inn["vout"]]["value"]}
       +                if utxo is not None:
       +                    total_input_value += int(Decimal(utxo["value"]) *
       +                        Decimal(1e8))
       +                    unconfirmed_input = (unconfirmed_input or
       +                        utxo["confirmations"] == 0)
       +                else:
       +                    # Electrum will now display a weird negative fee
       +                    self.log("WARNING: input utxo not found(!)")
        
       +            self.debug("total_input_value = " + str(total_input_value))
                    fee = total_input_value - sum([int(Decimal(out["value"])
                        * Decimal(1e8)) for out in txd["vout"]])
                    height = -1 if unconfirmed_input else 0