Skip to content

Conversation

@jtimon
Copy link
Contributor

@jtimon jtimon commented Feb 4, 2015

To move AreInputsStandard() and its consensus homologous to policy.o and consensus.o respectively without making those modules dependent on CCoinsModifier nor CCoinsViewCache, we need an interface that doesn't implement the method CCoins* AccessCoins(const uint256 &txid). This interface doesn't need several other methods from CCoinsViewCache.
You can see some code using this change at #5697

@theuni
Copy link
Member

theuni commented Feb 19, 2015

As discussed on IRC. The first commit (making CCoinsView an interface class and creating CCoinsViewDummy to reimplement the current CCoinsView) is confusing, and really doesn't add any functionality. I'd prefer to skip that.

@jtimon
Copy link
Contributor Author

jtimon commented Feb 20, 2015

I assume you're talking about HaveInputs(), GetValueIn(), GetPriority() and GetOutputFor()
Do we want those to be virtual?
Abstract classes often have methods implemented that use pure virtual methods that the child classes must implement like in here.
Are we expecting them to be reimplemented by child classes?

@theuni
Copy link
Member

theuni commented Feb 20, 2015

No, I just meant that the classes with virtual functions need virtual destructors.

@jtimon
Copy link
Contributor Author

jtimon commented Feb 20, 2015

Nits resolved.

@sipa
Copy link
Member

sipa commented Feb 20, 2015

I would prefer moving GetOutputFor, GetPriority, GetValueIn, and HaveInputs to become validation/policy related utiliy functions in main, avoiding the issue altogether.

@jtimon
Copy link
Contributor Author

jtimon commented Feb 20, 2015

haveinputs is used in consensus (see jtimon@0ac0610). GetValueIn (which uses GetOutputFor) could be modified to avoid some code duplication with consensus.
GetPriority could probably be moved to policy, I'm just not there yet.
In any case, this change doesn't prevent future changes in that direction.
To clarify, I misunderstood theuni in his previous comment, he was just talking about the virtual destructors which I fixed, so I'm not sure what the issue you want to avoid altogether is...

@sipa
Copy link
Member

sipa commented Mar 1, 2015

Ok, that can happen independently if it doesn't solve any controversy. I just don't think GetOutputFor, GetPriority, GetValueIn and HaveInputs belong in CCoins (despite me being the one who put them there).

@sipa
Copy link
Member

sipa commented Mar 1, 2015

untested ACK, but verified b627d9abbe25a11ffca02ef1f3ab312575e5e450 as moveonly.

@theuni
Copy link
Member

theuni commented Mar 15, 2015

utACK

@jtimon jtimon force-pushed the coins branch 2 times, most recently from f27707c to 83b9ce3 Compare March 25, 2015 11:17
@jtimon
Copy link
Contributor Author

jtimon commented Mar 25, 2015

Updated doing the includes better (not inclding coins.h nor coinscache.h from main.h), after doing that it needed rebase, so I rebased it. The non-includes code remains the same.

@jtimon
Copy link
Contributor Author

jtimon commented Mar 26, 2015

Needed rebase.

@jtimon
Copy link
Contributor Author

jtimon commented Apr 6, 2015

I'm having second thoughts about this, closing for now.

@jtimon jtimon closed this Apr 6, 2015
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants