bridge.sol: reuse functions to reduce logic duplication

This commit is contained in:
Maximilian Krüger 2018-01-05 16:31:46 +01:00
parent ea9f25003a
commit 1ca0439057
1 changed files with 3 additions and 3 deletions

View File

@ -201,12 +201,12 @@ contract HomeBridge {
// Order of operations below is critical to avoid TheDAO-like re-entry bug
withdraws[hash] = true;
uint estimatedWeiCostOfWithdraw = estimatedGasCostOfWithdraw * tx.gasprice;
// this fails if `value` is not even enough to cover the relay cost.
// Authorities simply IGNORE withdraws where `value` cant relay cost.
// Think of it as `value` getting burned entirely on the relay with no value left to pay out the recipient.
require(value > estimatedWeiCostOfWithdraw);
require(messageValueSufficientToCoverRelay(message));
uint estimatedWeiCostOfWithdraw = getWithdrawRelayCost();
// charge recipient for relay cost
uint valueRemainingAfterSubtractingCost = value - estimatedWeiCostOfWithdraw;