1
0

synchronizer/verifier: ensure fairness between wallets (follow-up)

follow-up to 4346d2fc76

It's not just about the Synchronizer, the Verifier should not starve other jobs either...
(previously I thought the Verifier is not too important as it only makes
requests if there are new txs; however with LNWatcher its progress is not persisted)
This commit is contained in:
SomberNight
2021-03-01 13:08:01 +01:00
parent e0cfb2179d
commit bf7129d57e
4 changed files with 11 additions and 7 deletions

View File

@@ -110,8 +110,9 @@ class LNChannelVerifier(NetworkJobOnDefaultServer):
# we are verifying channel announcements as they are from untrusted ln peers.
# we use electrum servers to do this. however we don't trust electrum servers either...
try:
result = await self.network.get_txid_from_txpos(
block_height, short_channel_id.txpos, True)
async with self._network_request_semaphore:
result = await self.network.get_txid_from_txpos(
block_height, short_channel_id.txpos, True)
except aiorpcx.jsonrpc.RPCError:
# the electrum server is complaining about the txpos for given block.
# it is not clear what to do now, but let's believe the server.
@@ -128,7 +129,8 @@ class LNChannelVerifier(NetworkJobOnDefaultServer):
# the electrum server sent an incorrect proof. blame is on server, not the ln peer
raise GracefulDisconnect(e) from e
try:
raw_tx = await self.network.get_transaction(tx_hash)
async with self._network_request_semaphore:
raw_tx = await self.network.get_transaction(tx_hash)
except aiorpcx.jsonrpc.RPCError as e:
# the electrum server can't find the tx; but it was the
# one who told us about the txid!! blame is on server