Skip to content

Commit

Permalink
signer/core: always pad clique header extra data with space for seale…
Browse files Browse the repository at this point in the history
…r's signature (ethereum#24941)

* signer/core: always pad clique header extra data with space for sealer's signature

* capitalize comment
  • Loading branch information
jwasinger authored and jagdeep sidhu committed Jun 1, 2022
1 parent ce1d2f7 commit 20dd3ce
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions signer/core/signed_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType
if err := rlp.DecodeBytes(cliqueData, header); err != nil {
return nil, useEthereumV, err
}
// The incoming clique header is already truncated, sent to us with a extradata already shortened
if len(header.Extra) < 65 {
// Need to add it back, to get a suitable length for hashing
newExtra := make([]byte, len(header.Extra)+65)
copy(newExtra, header.Extra)
header.Extra = newExtra
}
// Add space in the extradata to put the signature
newExtra := make([]byte, len(header.Extra)+65)
copy(newExtra, header.Extra)
header.Extra = newExtra

// Get back the rlp data, encoded by us
sighash, cliqueRlp, err := cliqueHeaderHashAndRlp(header)
if err != nil {
Expand Down

0 comments on commit 20dd3ce

Please sign in to comment.