Page MenuHomePhabricator

Separate adding and spending coins for a given transaction.
ClosedPublic

Authored by deadalnix on Jun 5 2018, 23:38.

Details

Summary

In addition, stop enforcing transaction ordering for RollforwardBlock by adding coin and spending them in two passes.

Depends on D1478

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jasonbcox requested changes to this revision.Jun 6 2018, 16:26
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/validation.cpp
1480–1486 ↗(On Diff #4067)

This block is not consistent with the other UpdateCoins() function. Shouldn't this be encapsulated in another SpendCoins() function, but without the CTxUndo param? As a side effect, the tx.IsCoinBase() check can be separated rather than wrapping the rest of the logic.

2264 ↗(On Diff #4067)

Why split this apart? Do you plan on removing UpdateCoin() all together?

This revision now requires changes to proceed.Jun 6 2018, 16:26
deadalnix added inline comments.
src/validation.cpp
1480–1486 ↗(On Diff #4067)

Why isn't it consistent ? It does the same, without updating the undo datastructure.

2264 ↗(On Diff #4067)

The goal of this refactoring is to get to a position where we add the output in one pass and then mark the coin spent in a second pass. Separating adding and spending is the first step toward this.

RollforwardBlock already does it in two passes, but ConnectBlock require some more refactoring and some activation mechanism before it can do it.

This revision is now accepted and ready to land.Jun 8 2018, 15:01
This revision was automatically updated to reflect the committed changes.