-
Notifications
You must be signed in to change notification settings - Fork 15
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
add proposer::TransactionPicker #153
Conversation
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.
utACK 3afc901
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
utACK
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.
I like the concept. Just some small questions about conventions in the other comments.
d63f7cc
to
d0d595c
Compare
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.
utACK
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. |
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.
utACK
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.
utACK d0d595c
This adds a class named
TransactionPicker
and introduces a new namespaceproposer
in 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
CBlockAssembler
which does too many things at once for my taste + deals with that horrendousCBlockTemplate
(see comment inBlockAssemblerAdapter
in 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 (
CValidationInterface
for instance) also. More recent work is on separating wallet and node and also here they start to create interfaces (bitcoin/bitcoin#14437,src/interfaces
).