tFix crash bug #120 by catching exception - 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 8488d0b1032ea42850f983835665925938b50481
DIR parent d5de8583b77fb38b50c58d979c15161ceab1049a
HTML Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date: Mon, 24 Jun 2019 22:43:29 +0100
Fix crash bug #120 by catching exception
The exception is raised if the unconfirmed input has been evicted
from the node's mempool. In this situation the server will just
carry on and Electrum will display an odd negative fee.
Diffstat:
M electrumpersonalserver/server/tran… | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
---
DIR diff --git a/electrumpersonalserver/server/transactionmonitor.py b/electrumpersonalserver/server/transactionmonitor.py
t@@ -245,17 +245,22 @@ class TransactionMonitor(object):
unconfirmed_input = False
total_input_value = 0
for inn in txd["vin"]:
- utxo = self.rpc.call("gettxout", [inn["txid"], inn["vout"],
- True])
- if utxo is None:
- utxo = self.rpc.call("gettxout", [inn["txid"], inn["vout"],
- False])
+ try:
+ utxo = self.rpc.call("gettxout", [inn["txid"],
+ inn["vout"], True])
if utxo is None:
- rawtx = self.rpc.call("getrawtransaction", [inn["txid"],
- True])
- if rawtx is not None:
- utxo = {"confirmations": 0,
- "value": rawtx["vout"][inn["vout"]]["value"]}
+ utxo = self.rpc.call("gettxout", [inn["txid"],
+ inn["vout"], False])
+ if utxo is None:
+ rawtx = self.rpc.call("getrawtransaction",
+ [inn["txid"], True])
+ if rawtx is not None:
+ utxo = {"confirmations": 0,
+ "value": rawtx["vout"][
+ inn["vout"]]["value"]}
+ except JsonRpcError:
+ #error somewhere, unable to get input value, just carry on
+ pass
if utxo is not None:
total_input_value += int(Decimal(utxo["value"]) *
Decimal(1e8))