-
Notifications
You must be signed in to change notification settings - Fork 284
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
mining: Move txMiningView from mempool package. #2467
Conversation
5ef70c8
to
4c44a2c
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.
Thanks. Looks good overall. Excellent PR description as well!
4c44a2c
to
229802f
Compare
@davecgh Thanks for the review. Good catch on some of the comments that needed to be corrected as well - those have been updated, and I noticed a couple of others that were still mentioning mempool as well and fixed those. |
Alright, #2458 has landed. This just needs a rebase and I'll get it merged. |
This moves txMiningView and txDescGraph to the mining package. This reduces the coupling between the mempool and mining packages and allows mining tests to use the actual txMiningView and txDescGraph implementations.
229802f
to
f30286b
Compare
Requires #2458
This moves txMiningView and txDescGraph to the mining package. This reduces the coupling between the mempool and mining packages and allows mining tests to use the actual txMiningView and txDescGraph implementations.
The more immediate reason I am looking to bring this in is that I am working toward adding a mining test harness. In its current state, most/all of the
txMiningView
andtxDescGraph
functionality would need to be duplicated in the test code.Summary of the changes (unfortunately, this couldn't really be split into multiple commits since the intermediate steps would be in a non-working state):
txMiningView
type and methods tomining/mining_view.go
.mining.*
everywhere in this file.txDescGraph
type and methods tomining/tx_desc_graph.go
.mining.*
everywhere in this file.txDescGraph
is only used internally bytxMiningView
.TxMiningView
to be exported and updated all references accordingly.AddTransaction
to be exported and updated all references accordingly.TxMiningView
interface and updatedmempool
to use the exportedmining.TxMiningView
type and methods.mempool
wanted to use an alternative mining view implementation (for testing or other purposes), it could make sense to have a mining view interface defined inmempool
.mempool
is only usingAddTransaction
,Remove
, andClone
fromTxMiningView
. However,mempool_test
uses quite a few otherTxMiningView
methods since it is validating that the internals ofTxMiningView
are set correctly. Testing these internals could be moved tomining
in the future, and then those other methods could be unexported.mining.NewTxMiningView
andmining.TxMiningView
Clone
methods formempool
to use instead of handling that logic directly.