Skip to content

Lesson 7: TransactionExecutionError: Transaction ran out of gas #5241

Closed Answered by alymurtazamemon
Jatinkkalra asked this question in Q&A
Discussion options

You must be logged in to vote

@Jatinkkalra Your loop inside withdraw function is running inappropriate way which makes the program consume a lot of gas. Fix it;

for (
    uint256 funderIndex = 0;
    funderIndex < funders.length;
    funderIndex = funderIndex++ /*ie funderIndex + 1*/
)

here funderIndex = funderIndex++ should be funderIndex++

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jatinkkalra
Comment options

Answer selected by Jatinkkalra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants