-
Notifications
You must be signed in to change notification settings - Fork 37.8k
MOVEONLY: Split Transaction and Block from core #5100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Missing some files. Any reason not to go ahead and move CTxOutCompressor/CTxInUndo/CTxUndo while you're at it, as discussed on IRC? |
Ok, I'll do a more complete PR, closing for now. |
|
That means txcompressor goes on its own (maybe take script/compressor with it?)
Does that mean txundo goes on its own as well? |
logically the compressor stuff is part of coins-- its the fancy, locally specific highly compressed seralization used only in the utxo set representation. Is there any reason it can't just go into coins.cpp/coins.h? Undo seem logically best placed with chain.* though it's a bit different since undo data (like the compressor) is only locally significant, most of chain.* is actually locally specific storage stuff for the chain in any case. |
Never mind, coins.o also depends on CTxInUndo so they both belong in their own files. |
CChain and CTxUndo don't depend on each other, why should they go together? |
Oh, and coins depends on CTxInUndo but not in chain or main. |
d0fe1cb
to
5a3ff87
Compare
Mhmm, blockundo can get out of main too. |
So undo data (CTxInUndo, CTxUndo, CBlockUndo) is is not directly depended on by chain, but CBlockIndex (in chain) contains references to where undo data is on disk, which makes it sort-of related. I'm fine with a separate file too. To avoid coins from depending on undo (or chain), CCoins::Spend could become a method (or function) on CTxInUndo. I think that method doesn't logically belong in coins anyway. |
Ok, so here's the plan:
I also want to decouple txout from feerate and move it out of core/transaction (to policy/fee ?) but I'll leave that for a later PR. |
@@ -0,0 +1,59 @@ | |||
// Copyright (c) 2012-2013 The Bitcoin developers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Why only 2013?
13d22e9
to
4f8d319
Compare
Can you move CBlockUndo to undo as well? |
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_CORE_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Rename and edit end comment?
Suggestion: After this is confirmed to be move-only etc. create a last pull, which does the clang-formatting!? |
9c5f844
to
3004ad3
Compare
I ended up starting with moving CFeeRate and the Amount constants to amount.o so I had to rebase and I included the nits. I added a last clang commit as suggested. |
An alternative would be moving the undo stuff to chain.h (it's about auxiliary data about chain validation). I prefer to have all undo stuff together :) |
I needed to rebase on top of master due to some minor include conflicts. |
ACK |
The clang fix included here makes the result much harder to review. Can you remove that? We'll do the clang fixes all at once before release, without mixing it with other changes. Sorry, @Diapolo - we'll get to it! |
Also, feel free to rebase & squash. As long as all commits are move-only, it's easy to check with git diff merge~:src..merge:dest. |
…or (from core) with it
Left the clang change out. Not sure if it's worth it to make a separate PR though. Aren't we applying clang to everything just before 0.10 ? |
@jtimon yes, that's what I meant - let's not bother with clang fixes now, as we'll do it all at once right before the 0.10 release. |
ACK - verified move-only. Do you plan on moving CBlockUndo to undo.h as well (after turning its read/write methods into main.cpp functions) ? |
sipa Since too many of my open PRs depend this I plan to do that in a later PR. |
Sure, a later PR sounds good. |
Done, CBlockUndo is moved to undo.h as part of #5111. |
#ifndef H_BITCOIN_TXUNDO | ||
#define H_BITCOIN_TXUNDO | ||
|
||
#include "compressor.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a trailing space here.
|
@laanwj comments? |
utACK |
99f41b9 MOVEONLY: core.o -> core/block.o (jtimon) 561e9e9 MOVEONLY: Move script/compressor out of script and put CTxOutCompressor (from core) with it (jtimon) 999a2ab MOVEONLY: separate CTxUndo out of core (jtimon) 4a3587d MOVEONLY: Separate CTransaction and dependencies from core (jtimon) eda3733 MOVEONLY: Move CFeeRate and Amount constants to amount.o (jtimon)
I think it's a bad practice to name files/directories simply "core" (this breaks automatic coredumps on many systems) - can we call it something else? |
On Unix-like systems core is a semi-magical file name since coredumps get written to it. |
I suspect this wouldn't be a problem if we didn't had executables at /src but... |
datatypes +1 |
9670a84 Move UndoWriteToDisk() and UndoReadFromDisk() to anon namespace (random-zebra) 4fe609f Decouple CBlockUndo from CDiskBlockPos (jtimon) 9703b0e Decouple miner.o and txmempool.o from CTxUndo (random-zebra) cdc8cdc Decouple CCoins from CTxInUndo (jtimon) Pull request description: Backport bitcoin#5111 Original description: > Built on top of bitcoin#5100. > coins.o doesn't need to depend on undo.h (Decouple CCoins from CTxInUndo) > miner.o neither (Decouple miner.o from CTxUndo) > Finally, CBlockUndo can be moved from main.h to undo.h if it is first decoupled from CDiskBlockPos. ACKs for top commit: furszy: utACK 9670a84 Fuzzbawls: re-utACK 9670a84 Tree-SHA512: d77110525f50a3085013ca9cb87550ff786ee06c5b938a9002fe3a434c7a35a425238d1b623a01c26bebb5075c7e1bea9bc2ff4638c0c1190df15196b7097e55
The main goal is to separate minimal core dependencies for script/interpreter. CFeeRate shouldn't be there, but that won't be move only.
This should help with #4692 and it's related to #4981 among other PRs