Skip to content

netsync: Rework external request from peer.#3500

Merged
davecgh merged 1 commit intodecred:masterfrom
davecgh:netsync_rework_request_from_peer
Aug 29, 2025
Merged

netsync: Rework external request from peer.#3500
davecgh merged 1 commit intodecred:masterfrom
davecgh:netsync_rework_request_from_peer

Conversation

@davecgh
Copy link
Member

@davecgh davecgh commented Aug 8, 2025

This requires #3499.

This reworks the logic that allows code external to the sync manager to request blocks, votes, and treasury spend transactions to both simplify and optimize it. The method now makes use of the same logic the sync manager itself uses when requesting data and no longer potentially returns an error.

Of particular note is that it now uses the same much more efficient code path that the sync manager itself uses to determine if a transaction is needed as opposed to the rather expensive legacy utxo-based query approach.

Finally, this also modifies the logic to potentially make more than one request if needed since it is technically more accurate and avoids any possibility of error even though the current request sizes are nowhere near the limits.

@davecgh davecgh added this to the 2.1.0 milestone Aug 8, 2025
@davecgh davecgh force-pushed the netsync_rework_request_from_peer branch from 68a9760 to a2d692d Compare August 8, 2025 19:28
Copy link
Member

@jholdstock jholdstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement! Is numRequested actually necessary? Cant you just use len(gdMsg.InvList)? Is there overhead associated with calling len?

@davecgh
Copy link
Member Author

davecgh commented Aug 15, 2025

I haven't tested it in a long time, so there might not be anymore, but there used to be extra overhead. I really just followed the same pattern used in the other paths that do the same thing.

@davecgh davecgh force-pushed the netsync_rework_request_from_peer branch from a2d692d to 408ac34 Compare August 17, 2025 21:32
@davecgh davecgh force-pushed the netsync_rework_request_from_peer branch 2 times, most recently from 81bbfd1 to 67dfcd2 Compare August 27, 2025 01:05
This reworks the logic that allows code external to the sync manager to
request blocks, votes, and treasury spend transactions to both simplify
and optimize it.  The method now makes use of the same logic the sync
manager itself uses when requesting data and no longer potentially
returns an error.

Of particular note is that it now uses the same much more efficient code
path that the sync manager itself uses to determine if a transaction is
needed as opposed to the rather expensive legacy utxo-based query
approach.

Finally, this also modifies the logic to potentially make more than one
request if needed since it is technically more accurate and avoids any
possibility of error even though the current request sizes are nowhere
near the limits.
@davecgh davecgh force-pushed the netsync_rework_request_from_peer branch from 67dfcd2 to 95a36a3 Compare August 29, 2025 00:10
@davecgh davecgh merged commit 95a36a3 into decred:master Aug 29, 2025
2 checks passed
@davecgh davecgh deleted the netsync_rework_request_from_peer branch August 29, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants