Remove Miner
Diagram Flow

Complete Flow Influence

Explanations
This is a smart contract that allows for the removal of a miner from the mining pool through an election vote using a threshold. The contract contains several functions that are used in the removal process.
The propose-removal function is called by a miner to propose the removal of another miner from the pool. The function first checks that the miner who initiated the proposal is currently in the mining pool, that the miner to be removed is also in the mining pool, and that the miner to be removed has not already been proposed for removal. If all of these conditions are met, the function adds the miner to be removed to a list of proposed removals.
Once a miner has been proposed for removal, other miners can vote on whether or not to remove them from the pool using the vote-positive-remove-request and vote-negative-remove-request functions. These functions check that the voter is not the miner being voted on, that the miner being voted on has been proposed for removal, and that the voter has not already voted. If these conditions are met, the function adds the vote to either the map-votes-accept-removal or map-votes-reject-removal map, depending on whether the vote is positive or negative.
The process-removal function is called once the threshold of positive votes is reached. This function removes the miner from the mining pool, updates the miners-list variable, and deletes the miner's entry in the map-is-miner map. The function also adds the miner to a blacklist to prevent them from rejoining the pool in the future. If the removal of the miner causes the new percentage of miners to fall below a critical threshold, the update-threshold function is called to adjust the threshold accordingly.
If N - threshold negative votes for the removal action are reached, the reject-removal function is called. This function simply clears the votes for the miner and does not remove them from the pool.
There are several other helper functions in the contract, such as has-voted-remove, which checks if a miner has already voted, and clear-votes-map-remove-vote, which clears all votes for a specific miner. These functions are used throughout the contract to help manage the removal process.
Smart Contract
Last updated