Skip to content
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

blockchain: Accept header in CheckProofOfWork. #977

Merged
merged 1 commit into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ func checkProofOfWork(header *wire.BlockHeader, powLimit *big.Int, flags Behavio
// CheckProofOfWork ensures the block header bits which indicate the target
// difficulty is in min/max range and that the block hash is less than the
// target difficulty as claimed.
func CheckProofOfWork(block *dcrutil.Block, powLimit *big.Int) error {
return checkProofOfWork(&block.MsgBlock().Header, powLimit, BFNone)
func CheckProofOfWork(header *wire.BlockHeader, powLimit *big.Int) error {
return checkProofOfWork(header, powLimit, BFNone)
}

// checkBlockHeaderSanity performs some preliminary checks on a block header to
Expand Down
3 changes: 2 additions & 1 deletion rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4205,7 +4205,8 @@ func handleGetWorkSubmission(s *rpcServer, hexData string) (interface{}, error)
block := dcrutil.NewBlockDeepCopyCoinbase(msgBlock)

// Ensure the submitted block hash is less than the target difficulty.
err = blockchain.CheckProofOfWork(block, activeNetParams.PowLimit)
err = blockchain.CheckProofOfWork(&block.MsgBlock().Header,
activeNetParams.PowLimit)
if err != nil {
// Anything other than a rule violation is an unexpected error,
// so return that error as an internal error.
Expand Down