protecting against re-entrancy attack

This commit is contained in:
mbeylin 2017-09-21 17:37:16 -04:00
parent b45e4b7952
commit 1d4682cd7c
2 changed files with 12 additions and 6 deletions

View File

@ -285,10 +285,9 @@ contract StandardBounty {
onlyFulfiller(_milestoneId, _fulfillmentId)
checkFulfillmentIsApprovedAndUnpaid(_milestoneId, _fulfillmentId)
{
fulfillments[_milestoneId][_fulfillmentId].fulfiller.transfer(fulfillmentAmounts[_milestoneId]);
fulfillments[_milestoneId][_fulfillmentId].paid = true;
numPaid[_milestoneId]++;
fulfillments[_milestoneId][_fulfillmentId].fulfiller.transfer(fulfillmentAmounts[_milestoneId]);
FulfillmentPaid(msg.sender, _milestoneId, _fulfillmentId);
}
@ -398,6 +397,15 @@ contract StandardBounty {
{
return fulfillments[_milestoneId].length;
}
/// @dev getNumMilestones() returns the number of milestones
/// @return Returns the number of fulfillments
function getNumMilestones()
public
constant
returns (uint)
{
return fulfillmentAmounts.length;
}
/// @dev unpaidAmount(): calculates the amount which
/// the bounty has yet to pay out

View File

@ -87,11 +87,9 @@ contract TokenBounty is StandardBounty {
onlyFulfiller(_milestoneId, _fulfillmentId)
checkFulfillmentIsApprovedAndUnpaid(_milestoneId, _fulfillmentId)
{
tokenContract.transfer(fulfillments[_milestoneId][_fulfillmentId].fulfiller, fulfillmentAmounts[_milestoneId]);
fulfillments[_milestoneId][_fulfillmentId].paid = true;
numPaid[_milestoneId]++;
tokenContract.transfer(fulfillments[_milestoneId][_fulfillmentId].fulfiller, fulfillmentAmounts[_milestoneId]);
FulfillmentPaid(msg.sender, _milestoneId, _fulfillmentId);
}