Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v (#2084).
This commit is contained in:
parent
ab319f2f4c
commit
3de1b81501
@ -406,10 +406,13 @@ export function splitSignature(signature: SignatureLike): Signature {
|
||||
} else {
|
||||
if (result.v == null) {
|
||||
result.v = 27 + result.recoveryParam;
|
||||
} else if (result.recoveryParam !== (1 - (result.v % 2))) {
|
||||
} else {
|
||||
const recId = (result.v === 0 || result.v === 1) ? result.v :(1 - (result.v % 2));
|
||||
if (result.recoveryParam !== recId) {
|
||||
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.r == null || !isHexString(result.r)) {
|
||||
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
|
||||
|
Loading…
Reference in New Issue
Block a user