mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Docs Solidity by example
This commit is contained in:
@@ -354,17 +354,6 @@ The full contract
|
||||
expiration = now + duration;
|
||||
}
|
||||
|
||||
function isValidSignature(uint256 amount, bytes memory signature)
|
||||
internal
|
||||
view
|
||||
returns (bool)
|
||||
{
|
||||
bytes32 message = prefixed(keccak256(abi.encodePacked(this, amount)));
|
||||
|
||||
// check that the signature is from the payment sender
|
||||
return recoverSigner(message, signature) == sender;
|
||||
}
|
||||
|
||||
/// the recipient can close the channel at any time by presenting a
|
||||
/// signed amount from the sender. the recipient will be sent that amount,
|
||||
/// and the remainder will go back to the sender
|
||||
@@ -391,6 +380,17 @@ The full contract
|
||||
selfdestruct(sender);
|
||||
}
|
||||
|
||||
function isValidSignature(uint256 amount, bytes memory signature)
|
||||
internal
|
||||
view
|
||||
returns (bool)
|
||||
{
|
||||
bytes32 message = prefixed(keccak256(abi.encodePacked(this, amount)));
|
||||
|
||||
// check that the signature is from the payment sender
|
||||
return recoverSigner(message, signature) == sender;
|
||||
}
|
||||
|
||||
/// All functions below this are just taken from the chapter
|
||||
/// 'creating and verifying signatures' chapter.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user