Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jansegre committed Jul 25, 2023
1 parent bbf74cf commit a7581ef
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions hathor/p2p/sync_v2/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,9 @@ def send_get_transactions_bfs(self, start_from: list[bytes], until_first_block:
The start_from list can contain blocks, but they won't be sent. For example if a block B1 has T1 and T2 as
transaction parents, start_from=[B1] and start_from=[T1, T2] will have the same result.
The stop condition is reaching transactions/inputs that have a first_block of height less or equan than the
The stop condition is reaching transactions/inputs that have a first_block of height less or equal than the
height of until_first_block. The other peer will return an empty response if it doesn't have any of the
stransactions in start_from or if it doesn't have the until_first_block block.
transactions in start_from or if it doesn't have the until_first_block block.
"""
self._setup_tx_streaming()
start_from_hexlist = [tx.hex() for tx in start_from]
Expand Down Expand Up @@ -1114,15 +1114,13 @@ def handle_data(self, payload: str) -> None:
# in the network, thus, we propagate it as well.
if tx.can_validate_full():
self.log.info('tx received in real time from peer', tx=tx.hash_hex, peer=self.protocol.get_peer_id())
self.on_new_tx(tx, conn=self.protocol, propagate_to_peers=True)
self.on_new_tx(tx, propagate_to_peers=True)
else:
self.log.info('skipping tx received in real time from peer',
tx=tx.hash_hex, peer=self.protocol.get_peer_id())

def on_new_tx(self, tx: BaseTransaction, *, conn: Optional['HathorProtocol'] = None,
quiet: bool = False, propagate_to_peers: bool = True,
skip_block_weight_verification: bool = False, sync_checkpoints: bool = False,
reject_locked_reward: bool = True) -> bool:
def on_new_tx(self, tx: BaseTransaction, *, quiet: bool = False, propagate_to_peers: bool = True,
sync_checkpoints: bool = False, reject_locked_reward: bool = True) -> bool:
""" This method handle everything related to adding potentially partially validated transactions.
Call this instead of HathorManager.on_new_tx, unless `tx` must be fully validated (for example when receiving
Expand Down

0 comments on commit a7581ef

Please sign in to comment.