Added function helper, few changes on ECRecover lib
This commit is contained in:
committed by
Francisco Giordano
parent
f8c0fab5d8
commit
4f44427966
@ -20,8 +20,9 @@ library ECRecovery {
|
||||
uint8 v;
|
||||
|
||||
//Check the signature length
|
||||
if (sig.length != 65)
|
||||
if (sig.length != 65) {
|
||||
return (address(0));
|
||||
}
|
||||
|
||||
// Divide the signature in r, s and v variables
|
||||
assembly {
|
||||
@ -31,14 +32,16 @@ library ECRecovery {
|
||||
}
|
||||
|
||||
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
|
||||
if (v < 27)
|
||||
v += 27;
|
||||
if (v < 27) {
|
||||
v += 27;
|
||||
}
|
||||
|
||||
// If the version is correct return the signer address
|
||||
if (v != 27 && v != 28)
|
||||
if (v != 27 && v != 28) {
|
||||
return (address(0));
|
||||
else
|
||||
} else {
|
||||
return ecrecover(hash, v, r, s);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user