I am trying to understand the reasoning for this: (for an online class)
mapping (uint => uint) public multiplier;
/**
* Called by the owner of the TollBoothOperator.
* Can be used to update a value.
* It should roll back if the vehicle type is 0.
* Setting the multiplier to 0 is equivalent to removing it and is acceptable.
* It should roll back if the same multiplier is already set to the vehicle type.
* @param vehicleType The type of the vehicle being set.
* @param multiplier The multiplier to use.
* @return Whether the action was successful.
* Emits LogMultiplierSet.
*/
function setMultiplier(uint vehicleType, uint multiplier) public returns(bool success) {
require(vehicleType > 0); //maybe just not equal to 0
int currentMultiplier = multiplier[vehicleType];
require(currentMultiplier == 0);
return true;
}
What is the point of having a boolean return type since the function will never get to the return value if it will not succeed since the transaction will be rolled back by the require statements.