diff --git a/torba/client/basedatabase.py b/torba/client/basedatabase.py index 91cd8347f..7c8e05606 100644 --- a/torba/client/basedatabase.py +++ b/torba/client/basedatabase.py @@ -110,6 +110,8 @@ def constraints_to_sql(constraints, joiner=' AND ', prepend_key=''): col, op = col[:-len('__lte')], '<=' elif key.endswith('__gt'): col, op = col[:-len('__gt')], '>' + elif key.endswith('__gte'): + col, op = col[:-len('__gte')], '>=' elif key.endswith('__like'): col, op = col[:-len('__like')], 'LIKE' elif key.endswith('__not_like'): @@ -166,7 +168,7 @@ def query(select, **constraints): sql.append('WHERE') sql.append(where) - if order_by is not None: + if order_by: sql.append('ORDER BY') if isinstance(order_by, str): sql.append(order_by) diff --git a/torba/server/block_processor.py b/torba/server/block_processor.py index 0140ebfab..49bb30cda 100644 --- a/torba/server/block_processor.py +++ b/torba/server/block_processor.py @@ -377,7 +377,9 @@ class BlockProcessor: for block in blocks: height += 1 - undo_info = self.advance_txs(height, block.transactions) + undo_info = self.advance_txs( + height, block.transactions, self.coin.electrum_header(block.header, height) + ) if height >= min_height: self.undo_infos.append((undo_info, height)) self.db.write_raw_block(block.raw, height) @@ -387,7 +389,7 @@ class BlockProcessor: self.headers.extend(headers) self.tip = self.coin.header_hash(headers[-1]) - def advance_txs(self, height, txs): + def advance_txs(self, height, txs, header): self.tx_hashes.append(b''.join(tx_hash for tx, tx_hash in txs)) # Use local vars for speed in the loops