CHIA-3957 Improve requesting transactions advertised via NewTransaction#20667
CHIA-3957 Improve requesting transactions advertised via NewTransaction#20667AmineKhaldi wants to merge 1 commit intoChia-Network:mainfrom
Conversation
|
I don't understand how this can be backwards compatible. When you send a Am I misunderstanding something? |
This doesn't ban the peer, the connection stays and the message gets ignored. |
a7b1e69 to
bd8f1f2
Compare
bd8f1f2 to
112ba3d
Compare
9ba3eb1 to
411ade2
Compare
411ade2 to
813d96c
Compare
5a053d1 to
7195d65
Compare
| random_peer.peer_node_id, | ||
| ) | ||
| except TransactionQueueFull: | ||
| continue |
There was a problem hiding this comment.
continue doesn't seem right here. If the queue is full, I would think it's very likely to be full after we request the transaction from another peer as well. Don't we have a queue or some kind of pacing that's meant to make sure we don't request more transactions when our processing queue is full?
There was a problem hiding this comment.
This is per peer, it's full for this peer.
There was a problem hiding this comment.
the exception would come from here, wouldn't it?
full_node.transaction_queue.put()
There was a problem hiding this comment.
That's what I mean by per peer.
if self._peers_transactions_queues[peer_id].priority_queue.qsize() >= self.peer_size_limit:
self.log.warning(f"Transaction queue full for peer {peer_id}")
raise TransactionQueueFull(f"Transaction queue full for peer {peer_id}")
There was a problem hiding this comment.
I don't see this code anywhere in this patch
There was a problem hiding this comment.
That's how full_node.transaction_queue.put() raises the exception in question.
7195d65 to
c2c8b03
Compare
c2c8b03 to
151d5af
Compare
| if spend_name in self.full_node.full_node_store.pending_tx_request: | ||
| self.full_node.full_node_store.pending_tx_request.pop(spend_name) | ||
| else: |
There was a problem hiding this comment.
I think you can remove full_node.full_node_store.pending_tx_request entirely now. right? As you pointed out, we always clear the request in the finally block in tx_request_and_timeout(), so it doesn't really mean much here. The request is quite unlikely to be found in this set.
| if transaction_id in full_node.full_node_store.pending_tx_request: | ||
| full_node.full_node_store.pending_tx_request.pop(transaction_id) | ||
| if task_id in full_node.full_node_store.tx_fetch_tasks: | ||
| full_node.full_node_store.tx_fetch_tasks.pop(task_id) |
There was a problem hiding this comment.
with this change of using call_api(), all of these should probably be reviewed. It's not obvious that we need them anymore. especially pending_tx_request, I would expect to not be necessary
There was a problem hiding this comment.
We need pending_tx_request for new_transaction.
151d5af to
0f5e5e2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
0f5e5e2 to
4fc03ba
Compare
Pull Request Test Coverage Report for Build 23496106266Details
💛 - Coveralls |
4fc03ba to
9a0dcd5
Compare

Note
Medium Risk
Changes the transaction-fetch path to use synchronous
request_transactionRPC responses and enqueue results into the per-peerTransactionQueue, which could affect mempool propagation and retry behavior under load. Test-only adjustments toexpected_mempool_responsesreduce flakiness but also change assumptions about connection counters.Overview
Improves how a full node fetches transactions it learns about via peer advertisements by switching from fire-and-forget
request_transaction+ sleep polling to an awaitedcall_api(FullNodeAPI.request_transaction)flow, then enqueuing the received spend into theTransactionQueue(with fallback to alternate peers if a peer queue is full).Adjusts mempool response expectation accounting by resetting
expected_mempool_responses(including the old-peer mempool sync case) instead of incrementing it, and updates several tests to match this new semantics.Written by Cursor Bugbot for commit 9a0dcd5. This will update automatically on new commits. Configure here.