mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
core/types: expose sigHash as Hash for SetCodeAuthorization
Rename the private sigHash() method to public Hash() method for SetCodeAuthorization to maintain consistency with other transaction types and enable easier transaction handling without using default signing capabilities. Fixes #32297 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a56558d092
commit
52a0eba0c0
1 changed files with 3 additions and 3 deletions
|
|
@ -89,7 +89,7 @@ type authorizationMarshaling struct {
|
||||||
|
|
||||||
// SignSetCode creates a signed the SetCode authorization.
|
// SignSetCode creates a signed the SetCode authorization.
|
||||||
func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAuthorization, error) {
|
func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAuthorization, error) {
|
||||||
sighash := auth.sigHash()
|
sighash := auth.Hash()
|
||||||
sig, err := crypto.Sign(sighash[:], prv)
|
sig, err := crypto.Sign(sighash[:], prv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SetCodeAuthorization{}, err
|
return SetCodeAuthorization{}, err
|
||||||
|
|
@ -105,7 +105,7 @@ func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAutho
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *SetCodeAuthorization) sigHash() common.Hash {
|
func (a *SetCodeAuthorization) Hash() common.Hash {
|
||||||
return prefixedRlpHash(0x05, []any{
|
return prefixedRlpHash(0x05, []any{
|
||||||
a.ChainID,
|
a.ChainID,
|
||||||
a.Address,
|
a.Address,
|
||||||
|
|
@ -115,7 +115,7 @@ func (a *SetCodeAuthorization) sigHash() common.Hash {
|
||||||
|
|
||||||
// Authority recovers the the authorizing account of an authorization.
|
// Authority recovers the the authorizing account of an authorization.
|
||||||
func (a *SetCodeAuthorization) Authority() (common.Address, error) {
|
func (a *SetCodeAuthorization) Authority() (common.Address, error) {
|
||||||
sighash := a.sigHash()
|
sighash := a.Hash()
|
||||||
if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) {
|
if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) {
|
||||||
return common.Address{}, ErrInvalidSig
|
return common.Address{}, ErrInvalidSig
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue