electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

commit a0a6851c1910b1749cab409b967a7ad6698adce8
parent 538d5b613cd8ef6d8f8acb9fe5c0c0c5eaee6da1
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Fri, 22 Jun 2018 11:01:58 +0100

Fix crash when listtransactions has >1000 entries

Fix crash from issue #25. Caused by listtransactions having more than
1000 entries which results in last_known_wallet_txid having the wrong
value

Diffstat:
Melectrumpersonalserver/transactionmonitor.py | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/electrumpersonalserver/transactionmonitor.py b/electrumpersonalserver/transactionmonitor.py @@ -99,10 +99,13 @@ class TransactionMonitor(object): t = 0 count = 0 obtained_txids = set() + last_tx = None while len(ret) == BATCH_SIZE: ret = self.rpc.call("listtransactions", ["*", BATCH_SIZE, t, True]) self.debug("listtransactions skip=" + str(t) + " len(ret)=" + str(len(ret))) + if t == 0: + last_tx = ret[-1] t += len(ret) for tx in ret: if "txid" not in tx or "category" not in tx: @@ -165,8 +168,8 @@ class TransactionMonitor(object): if len(ret) > 0: #txid doesnt uniquely identify transactions from listtransactions #but the tuple (txid, address) does - self.last_known_wallet_txid = (ret[-1]["txid"], - ret[-1].get("address", None)) + self.last_known_wallet_txid = (last_tx["txid"], + last_tx.get("address", None)) else: self.last_known_wallet_txid = None self.debug("last_known_wallet_txid = " + str(