Skip to content

Commit 903cb72

Browse files
author
Neil Booth
committed
Tweak use of self.ok
1 parent 7d12c95 commit 903cb72

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

electrumx/server/block_processor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def __init__(self, env, db, daemon, notifications):
282282
self.coin = env.coin
283283

284284
self.caught_up = False
285-
self.ok = False
285+
self.ok = True
286286
self.touched = set()
287287
# A count >= 0 is a user-forced reorg; < 0 is a natural reorg
288288
self.reorg_count = None
@@ -498,12 +498,12 @@ def advance_block(self, block):
498498
to_le_uint32 = pack_le_uint32
499499
to_le_uint64 = pack_le_uint64
500500

501-
self.ok = False
502501
with block as block:
503502
if self.coin.header_prevhash(block.header) != self.state.tip:
504503
self.reorg_count = -1
505504
return
506505

506+
self.ok = False
507507
for tx, tx_hash in block.iter_txs():
508508
hashXs = []
509509
append_hashX = hashXs.append
@@ -573,6 +573,7 @@ def backup_block(self, block):
573573

574574
count = 0
575575
with block as block:
576+
self.ok = False
576577
for tx, tx_hash in block.iter_txs_reversed():
577578
for idx, txout in enumerate(tx.outputs):
578579
# Spend the TX outputs. Be careful with unspendable
@@ -606,6 +607,7 @@ def backup_block(self, block):
606607
# self.touched can include other addresses which is harmless, but remove None.
607608
self.touched.discard(None)
608609
self.db.flush_backup(self.flush_data(), self.touched)
610+
self.ok = True
609611

610612
'''An in-memory UTXO cache, representing all changes to UTXO state
611613
since the last DB flush.

0 commit comments

Comments
 (0)