Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Oct 19, 2020

Built on top of #1904 . PR starting on 9123d22.

listmasternodes RPC command was taking a considerable amount of time, checked the flow and discovered a lot of redundancies in the process. This PR aims to correct them.

  1. CMasternodeMan::GetMasternodeRanks is only used for an RPC call and it was checking and validating each Masternode instead of just retrieve them as it suppose to be doing (the tier two thread is the only one responsible of check and update the masternodes list).

  2. CMasternodeMan::GetMasternodeRanks had a totally unneeded second vector load. Looping over the entire masternodes list one more time after getting it.

  3. listmasternodes after calling GetMasternodeRanks was looking for each of the retrieved masternodes one more time using the retrieved masternode vin (yes..).

@furszy furszy self-assigned this Oct 19, 2020
…ons and totally unnecessary extra vector load.

As this function is only used in listmasternodes RPC command, the checks are redundant, the MN thread only should check and update `vMasternodes`, removing any invalid masternode.
…n the mnnodeman.

listmasternodes first calls GetMasternodeRanks, which loops over the MN list, then was calling `mnodeman.Find` which loops again over the MN list for absolutely no reason.
@furszy furszy force-pushed the 2020_speedup_listmasternodes branch from 5eb6372 to 872da91 Compare October 20, 2020 05:16
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Great catch! 🥃
ACK 872da91

@random-zebra random-zebra added this to the 5.0.0 milestone Oct 20, 2020
@furszy furszy requested a review from Fuzzbawls October 24, 2020 06:02
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 872da91

@furszy furszy merged commit 2dc9704 into PIVX-Project:master Oct 25, 2020
@furszy furszy deleted the 2020_speedup_listmasternodes branch November 29, 2022 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants