RocketMinipoolDelegate - Redundant refund() call on forced finalization
The `RocketMinipoolDelegate.refund` function will force finalization if a user previously distributed the pool. However, `_finalise` already calls `_refund()` if there is a node refund balance to transfer, making the additional call to `_refund()` in `refund()` obsolete.\\n```\\nfunction refund() override external onlyMinipoolOwnerOrWithdrawalAddress(msg.sender) onlyInitialised {\\n    // Check refund balance\\n    require(nodeRefundBalance > 0, "No amount of the node deposit is available for refund");\\n    // If this minipool was distributed by a user, force finalisation on the node operator\\n    if (!finalised && userDistributed) {\\n        \\_finalise();\\n    }\\n    // Refund node\\n    \\_refund();\\n}\\n```\\n\\n```\\nfunction \\_finalise() private {\\n    // Get contracts\\n    RocketMinipoolManagerInterface rocketMinipoolManager = RocketMinipoolManagerInterface(getContractAddress("rocketMinipoolManager"));\\n    // Can only finalise the pool once\\n    require(!finalised, "Minipool has already been finalised");\\n    // Set finalised flag\\n    finalised = true;\\n    // If slash is required then perform it\\n    if (nodeSlashBalance > 0) {\\n        \\_slash();\\n    }\\n    // Refund node operator if required\\n    if (nodeRefundBalance > 0) {\\n        \\_refund();\\n    }\\n```\\n
Resolution\\nFixed in https://github.com/rocket-pool/rocketpool/tree/77d7cca65b7c0557cfda078a4fc45f9ac0cc6cc6 by refactoring `refund()` to avoid a double invocation of `_refund()` in the `_finalise()` codepath.\\nFixed per the recommendation. Thanks.\\nWe recommend refactoring the if condition to contain `_refund()` in the else branch.
```\\nfunction refund() override external onlyMinipoolOwnerOrWithdrawalAddress(msg.sender) onlyInitialised {\\n    // Check refund balance\\n    require(nodeRefundBalance > 0, "No amount of the node deposit is available for refund");\\n    // If this minipool was distributed by a user, force finalisation on the node operator\\n    if (!finalised && userDistributed) {\\n        \\_finalise();\\n    }\\n    // Refund node\\n    \\_refund();\\n}\\n```\\n