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

Validate GetBlockTemplate extra data #1997

Merged
merged 3 commits into from Apr 2, 2022

Conversation

someone235
Copy link
Collaborator

No description provided.

@@ -27,6 +27,11 @@ func HandleGetBlockTemplate(context *rpccontext.Context, _ *router.Router, reque
}

coinbaseData := &externalapi.DomainCoinbaseData{ScriptPublicKey: scriptPublicKey, ExtraData: []byte(version.Version() + "/" + getBlockTemplateRequest.ExtraData)}
if uint64(len(coinbaseData.ExtraData)) > context.Config.NetParams().MaxCoinbasePayloadLength {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you need to check len(ExtraData) + len(script) + script constants

@codecov
Copy link

codecov bot commented Apr 2, 2022

Codecov Report

Merging #1997 (f225191) into dev (95fa045) will increase coverage by 0.00%.
The diff coverage is 54.28%.

@@           Coverage Diff           @@
##              dev    #1997   +/-   ##
=======================================
  Coverage   57.15%   57.16%           
=======================================
  Files         685      685           
  Lines       32995    33023   +28     
=======================================
+ Hits        18859    18877   +18     
- Misses      11452    11462   +10     
  Partials     2684     2684           
Impacted Files Coverage Δ
app/rpc/rpchandlers/get_block_template.go 39.13% <0.00%> (-8.24%) ⬇️
...ver/grpcserver/protowire/rpc_get_block_template.go 66.07% <63.33%> (-2.68%) ⬇️
...ain/consensus/database/binaryserialization/hash.go 69.56% <0.00%> (-8.70%) ⬇️
...selectedchainstore/headers_selected_chain_store.go 72.09% <0.00%> (-3.49%) ⬇️
infrastructure/network/rpcclient/rpcclient.go 67.41% <0.00%> (+4.49%) ⬆️
infrastructure/network/netadapter/router/route.go 88.57% <0.00%> (+5.71%) ⬆️
infrastructure/network/rpcclient/rpc_get_info.go 63.63% <0.00%> (+18.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 95fa045...f225191. Read the comment docs.

@someone235 someone235 merged commit d45af76 into kaspanet:dev Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants