-
Notifications
You must be signed in to change notification settings - Fork 215
Proofs pool upsert #6887
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
Proofs pool upsert #6887
Conversation
| } | ||
|
|
||
| // AddProof will add the provided proof to the pool, if it's not already in the pool. | ||
| // It will return true if the proof the was added to the pool. |
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.
| // It will return true if the proof the was added to the pool. | |
| // It will return true if the proof was added to the pool. |
| if check.IfNil(argument.ValidityAttester) { | ||
| return nil, process.ErrNilValidityAttester | ||
| } | ||
| if check.IfNil(argument.ProofsPool) { |
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.
not need, it is only forwarded to the component
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.
removed check
| func (pp *proofsPool) UpsertProof( | ||
| headerProof data.HeaderProofHandler, | ||
| ) bool { | ||
| if check.IfNilReflect(headerProof) { |
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.
check.IfNil instead for proofs IsInterfaceNil was added for the HeaderProofHandler
|
|
||
| // IsProofInPoolEqualTo will check if the provided proof is equal with the already existing proof in the pool | ||
| func (pp *proofsPool) IsProofInPoolEqualTo(headerProof data.HeaderProofHandler) bool { | ||
| if check.IfNilReflect(headerProof) { |
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.
check.IfNil instread
| if common.ShouldBlockHavePrevProof(interceptedHdr.HeaderHandler(), hip.enableEpochsHandler, common.EquivalentMessagesFlag) { | ||
| ok = hip.proofs.AddProof(interceptedHdr.HeaderHandler().GetPreviousProof()) | ||
| log.Trace("HdrInterceptorProcessor.AddProof: add previous proof", "intercepted header hash", interceptedHdr.Hash(), "added", ok) | ||
| ok = hip.proofs.UpsertProof(interceptedHdr.HeaderHandler().GetPreviousProof()) |
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.
I think we can remove this one, and update to upsert the one in VerifyHeaderWithProof
also it could be removed also from saveProofForPreviousHeaderIfNeeded as it should have already added on verifyHeaderWithProof
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.
removed duplicated add prev proofs
| // NewInterceptedMetaHeaderDataFactory creates an instance of interceptedMetaHeaderDataFactory | ||
| func NewInterceptedMetaHeaderDataFactory(argument *ArgInterceptedDataFactory) (*interceptedMetaHeaderDataFactory, error) { | ||
| func NewInterceptedMetaHeaderDataFactory(argument *ArgInterceptedMetaHeaderFactory) (*interceptedMetaHeaderDataFactory, error) { | ||
| if argument == nil { |
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.
check for not nil proofs pool?
Reasoning behind the pull request
Upsert,IsProofInPoolEqualToTesting procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?