Refactor PoW implementation to include peerID in data #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces changes to the Proof of Work (PoW) implementation in the
core/apps/verifier/pow.go
file to include thepeerID
in the PoW process. This ensures that the PoW is tied to a specific peer, enhancing security and traceability. Additionally, corresponding updates are made to the test cases in thecore/apps/verifier/pow_test.go
file.Key changes include:
Proof of Work Enhancements:
performPoW
to includepeerID
as a parameter, updating the input format to include thepeerID
in the hash calculation. (core/apps/verifier/pow.go
, [1] [2]verifyPoW
to includepeerID
as a parameter, ensuring the verification process checks the hash with thepeerID
. (core/apps/verifier/pow.go
, core/apps/verifier/pow.goL121-R122)PoW Request and Response Handling:
OnPoWRequest
andOnPoWResponse
methods to passpeerID
when callingperformPoW
andverifyPoW
. (core/apps/verifier/pow.go
, [1] [2]Test Case Updates:
pow_test.go
to includepeerID
in bothperformPoW
andverifyPoW
calls, ensuring tests validate the new behavior. (core/apps/verifier/pow_test.go
, core/apps/verifier/pow_test.goL12-R37)