forked from LBRYCommunity/lbry-sdk
fix touched hashXs notifications
This commit is contained in:
parent
ea1285cd9f
commit
6e221fc7d9
1 changed files with 3 additions and 1 deletions
|
@ -328,7 +328,7 @@ class BlockProcessor:
|
||||||
self.logger.info('processed {:,d} block{} in {:.1f}s'.format(len(blocks), s, processed_time))
|
self.logger.info('processed {:,d} block{} in {:.1f}s'.format(len(blocks), s, processed_time))
|
||||||
if self._caught_up_event.is_set():
|
if self._caught_up_event.is_set():
|
||||||
await self.notifications.on_block(self.touched, self.height)
|
await self.notifications.on_block(self.touched, self.height)
|
||||||
self.touched = set()
|
self.touched.clear()
|
||||||
elif hprevs[0] != chain[0]:
|
elif hprevs[0] != chain[0]:
|
||||||
min_start_height = max(self.height - self.coin.REORG_LIMIT, 0)
|
min_start_height = max(self.height - self.coin.REORG_LIMIT, 0)
|
||||||
count = 1
|
count = 1
|
||||||
|
@ -1296,6 +1296,7 @@ class BlockProcessor:
|
||||||
def add_utxo(self, tx_hash: bytes, tx_num: int, nout: int, txout: 'TxOutput') -> Optional[bytes]:
|
def add_utxo(self, tx_hash: bytes, tx_num: int, nout: int, txout: 'TxOutput') -> Optional[bytes]:
|
||||||
hashX = self.coin.hashX_from_script(txout.pk_script)
|
hashX = self.coin.hashX_from_script(txout.pk_script)
|
||||||
if hashX:
|
if hashX:
|
||||||
|
self.touched.add(hashX)
|
||||||
self.utxo_cache[(tx_hash, nout)] = hashX
|
self.utxo_cache[(tx_hash, nout)] = hashX
|
||||||
self.db_op_stack.extend([
|
self.db_op_stack.extend([
|
||||||
RevertablePut(
|
RevertablePut(
|
||||||
|
@ -1332,6 +1333,7 @@ class BlockProcessor:
|
||||||
)
|
)
|
||||||
raise ChainError(f"{hash_to_hex_str(tx_hash)}:{nout} is not found in UTXO db for {hash_to_hex_str(hashX)}")
|
raise ChainError(f"{hash_to_hex_str(tx_hash)}:{nout} is not found in UTXO db for {hash_to_hex_str(hashX)}")
|
||||||
# Remove both entries for this UTXO
|
# Remove both entries for this UTXO
|
||||||
|
self.touched.add(hashX)
|
||||||
self.db_op_stack.extend([
|
self.db_op_stack.extend([
|
||||||
RevertableDelete(hdb_key, hashX),
|
RevertableDelete(hdb_key, hashX),
|
||||||
RevertableDelete(udb_key, utxo_value_packed)
|
RevertableDelete(udb_key, utxo_value_packed)
|
||||||
|
|
Loading…
Reference in a new issue