Unverified Commit 3ff479bc authored by jwasinger's avatar jwasinger Committed by GitHub

signer/core: always pad clique header extra data with space for sealer's signature (#24941)

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

* capitalize comment
parent 94c8de02
...@@ -147,13 +147,11 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType ...@@ -147,13 +147,11 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType
if err := rlp.DecodeBytes(cliqueData, header); err != nil { if err := rlp.DecodeBytes(cliqueData, header); err != nil {
return nil, useEthereumV, err return nil, useEthereumV, err
} }
// The incoming clique header is already truncated, sent to us with a extradata already shortened // Add space in the extradata to put the signature
if len(header.Extra) < 65 { newExtra := make([]byte, len(header.Extra)+65)
// Need to add it back, to get a suitable length for hashing copy(newExtra, header.Extra)
newExtra := make([]byte, len(header.Extra)+65) header.Extra = newExtra
copy(newExtra, header.Extra)
header.Extra = newExtra
}
// Get back the rlp data, encoded by us // Get back the rlp data, encoded by us
sighash, cliqueRlp, err := cliqueHeaderHashAndRlp(header) sighash, cliqueRlp, err := cliqueHeaderHashAndRlp(header)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment