mirror of https://github.com/nucypher/nucypher.git
Simplify StakingEscrow.confirmActivity(): only direct calls from Worker
parent
1387683e35
commit
dd23408ca7
|
@ -639,16 +639,9 @@ contract StakingEscrow is Issuer {
|
||||||
* @notice Confirm activity for the next period and mine for the previous period
|
* @notice Confirm activity for the next period and mine for the previous period
|
||||||
**/
|
**/
|
||||||
function confirmActivity() external {
|
function confirmActivity() external {
|
||||||
address staker = msg.sender;
|
address staker = getStakerByWorker(msg.sender);
|
||||||
// sender is staker -> staker is an intermediary contract
|
require(stakerInfo[staker].value > 0, "Staker must have a stake to confirm activity");
|
||||||
if (stakerInfo[staker].value > 0) {
|
require(msg.sender == tx.origin, "Only worker with real address can confirm activity");
|
||||||
require(getWorkerByStaker(staker) == tx.origin, "Only worker can confirm activity");
|
|
||||||
} else {
|
|
||||||
// staker is not a contract -> sender is worker
|
|
||||||
staker = getStakerByWorker(msg.sender);
|
|
||||||
require(stakerInfo[staker].value > 0, "Staker must have a stake to confirm activity");
|
|
||||||
require(msg.sender == tx.origin, "Only worker with real address can confirm activity");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16 lastActivePeriod = getLastActivePeriod(staker);
|
uint16 lastActivePeriod = getLastActivePeriod(staker);
|
||||||
mint(staker);
|
mint(staker);
|
||||||
|
|
Loading…
Reference in New Issue