-
Notifications
You must be signed in to change notification settings - Fork 725
Decouple peer-processing-logic from block-connection-logic + BIP61 removal. #2464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple peer-processing-logic from block-connection-logic + BIP61 removal. #2464
Conversation
4b233a8 to
8320fd6
Compare
edc5520 to
82ea177
Compare
|
Rebased on master, lint-python warnings fixed. Ready to go. |
82ea177 to
e1c01c4
Compare
|
And.. the rebase came with few needed changes. All good now, ready. |
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice PR. Just few nits
e1c01c4 to
b5afa79
Compare
Backport of btc@fa25f43ac5692082dba3f90456c501eb08f1b75c and btc@b1b0cfecb639ce44be280c7a45a41a19e893c401
…invalid arriving block. 1) The actual peer misbehaving check is being performed inside PeerLogicValidation::BlockChecked. 2) The CValidationState inputted to ProcessNewBlock does not return the error nor invalidity reason if the block is marked as invalid during the activate best chain process (thus why BlockChecked exists).
…s in State() call and mapBlockIndex access.
…ocessNewBlock. Any block processing error is being notified by the BlockChecked signal.
Aside from the code responsibilities division improvement, this adds the good property of checking block spam filter for blocks that were rejected during the connection process as well (before, was only called if AcceptBlock rejected the block).
Plus pass pblock as const reference.
Plus minor cleanup, removing unused parameter.
…and made static as them are only used there.
…ect GetCommand call. The array is duplicated with the NetMsgType constants
…and evo_deterministicmns_tests files.
b5afa79 to
f16f422
Compare
|
Updated per zebra's feedback, squashing all the updates in their respective commits, and rebased it on master so it has the correct bench raw files generation. To minimize the review mental burden --> |
Do not loop over every protocol message type, only walk through the tier two possible messages.
f16f422 to
8e9f2bc
Compare
|
updated, added the vector change. |
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 8e9f2bc
broken due to merges of PIVX-Project#2438 + PIVX-Project#2464
4155b48 [Tests] Fix ProcessNewBlock signature in budget_tests.cpp (random-zebra) Pull request description: broken due to merges of #2438 + #2464 Top commit has no ACKs. Tree-SHA512: 1df1a7a45be0cdaca9409f2698220dfcf025df2fe784d28bd9d7b084a73718d4fccfad5def3296992f5bb4e78c0fea5860651b28c6e61f1c121a08e4df1e1535
Continuation of #2463. Another error prone topic.
Essentially focused in the following points:
Remove duplicate and incorrect peer misbehaving:
-1) The peer misbehaving score set for an invalid arriving block is being performed inside
PeerLogicValidation::BlockChecked.-2) The
CValidationStateparam inProcessNewBlockdoes not return the error nor the invalidity reason if the block is marked invalid during the activate best chain process (block connection), an emptyCValidationStateis set. TheBlockCheckedsignal is used instead to notify the block invalidity reason.Get rid off
CValidationStateparam inProcessNewBlockand use onlyBlockChecked(own version of ae22357)Removal of BIP61 (p2p: Remove BIP61 reject messages bitcoin/bitcoin#15437 and test: Remove REJECT message code bitcoin/bitcoin#18609).
-- BIP61 could be disabled first by default before its removal like upstream did (or moved to its own standalone PR), but.. i don't think that worth to continue maintaining it, most likely no one is using it and if someone is actually using it, isn't good to have any piece of software depending on it. --
Move block spam filter check to
BlockChecked. Following the same peer-processing-logic / block-connection-logic division. Improves the spam protection as now blocks rejected during the connection process are going to pass through the spam filter check as well (before, only blocks rejected duringAcceptBlockwere passing through it).Plus, this improvement let me do some further cleanup and remove the extra
fAcceptedflag fromProcessNewBlock.Create
GetDataMsgenum and replaceppszTypeNamearray for directGetCommandcall.The array was duplicated with the
NetMsgTypeconstants