Conversation
|
@Gnappuraz Thanks for your approval :-) @AM5800 @Ruteri WDYT? I'd be very much interested in your opinion. |
src/proposer/transactionpicker.h
Outdated
| virtual ~TransactionPicker() = default; | ||
|
|
||
| //! \brief Factory method for creating a BlockAssemblerAdapter | ||
| static std::unique_ptr<TransactionPicker> BlockAssemblerAdapter( |
There was a problem hiding this comment.
my personal opinion: avoid any collisions, e.g., all these names should be unique:
- namespace
- class name
- function names
- local variables
Otherwise, it can confuse the reader. maybe think of another name for it?
and then you don't need to explicitly use class keyword when instantiating the object.
new class BlockAssemblerAdapter(chainParams));
fe454ca to
d0d595c
Compare
cornelius
left a comment
There was a problem hiding this comment.
I like the concept. Just some small questions about conventions in the other comments.
d63f7cc to
d0d595c
Compare
|
For the newcommers: When reviewing we try to stick to the contribution guidelines outlined by bitcoin, which are documented in https://github.com/dtr-org/unit-e/blob/master/CONTRIBUTING.md#peer-review Additionally we use githubs review/approve mechanism. |
This adds a class named
TransactionPickerand introduces a new namespaceproposerin its own directory. I sort of got fed up of the untestability of bitcoin and that everything is intertwined with each other directly.In order to propose a block I need to build one which is I have to (1) pick transactions (2) put a coinstake transaction (includes block height, signature, reward output) (3) sign the thing. Picking transactions is already implemented in bitcoin but it's well buried inside
CBlockAssemblerwhich does too many things at once for my taste + deals with that horrendousCBlockTemplate(see comment inBlockAssemblerAdapterin the source).Since I want my Proposer to be testable and (1+2+3) are essentially simple operations I want the code to be simple. So here is the part which performs 1, by delegating to bitcoin's block assembler (for now). This way I do not have to change the block assembler or overwrite the coinbase transaction in the block template.
I would be interested in hearing your thoughts about my approach, as I intend to follow it with everything I do from now on. Maybe you are fundamentally opposed to virtual methods or whatever.
In bitcoin there have been small efforts to extract things into Interfaces (
CValidationInterfacefor instance) also. More recent work is on separating wallet and node and also here they start to create interfaces (bitcoin/bitcoin#14437,src/interfaces).