Page MenuHomePhabricator

Separate adding and spending coins for a given transaction.
ClosedPublic

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

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Commits
Restricted Diffusion Commit
rABCfa411b712945: Separate adding and spending coins for a given transaction.
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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Jun 5 2018, 23:38
Herald added a reviewer: Restricted Project. · View Herald TranscriptJun 5 2018, 23:38
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 requested review of this revision.Jun 6 2018, 17:03
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.

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