-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(coinbase-extra): add coinbase extra field #67
feat(coinbase-extra): add coinbase extra field #67
Conversation
src/cli/commands/util.rs
Outdated
let share_chain_random_x = InMemoryShareChain::new( | ||
MAX_BLOCKS_COUNT, | ||
PowAlgorithm::RandomX, | ||
Some(block_validation_params.clone()), | ||
consensus_manager, | ||
coinbase_extras.clone(), |
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.
These should be two different hashmaps
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.
okay, makes sense let me update
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.
updated
src/server/grpc/p2pool.rs
Outdated
@@ -77,6 +78,8 @@ where S: ShareChain | |||
stats_max_difficulty_since_last_success: Arc<RwLock<Difficulty>>, | |||
consensus_manager: ConsensusManager, | |||
submit_block_semaphore: Arc<Semaphore>, | |||
tribe: Tribe, |
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.
Let's change this to Squad and replace all instances of tribe
with Squad
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.
done
src/sharechain/in_memory.rs
Outdated
let mut coinbase_extra = convert_coinbase_extra(tribe.clone(), String::new()).unwrap_or_default(); | ||
if let Ok(miner_wallet_address) = TariAddress::from_str(key.as_str()) { | ||
if let Some(coinbase_extra_found) = | ||
self.find_coinbase_extra(bl.levels.iter(), miner_wallet_address).await |
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.
This is O(n^2) and will be slow, I think find a better way of doing this without iterating through all the levels
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.
totally makes sense, let me refactor
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.
Okay just pushed!
I removed the unneeded iteration, just using the provided coinbase cache and update there the values when adding new blocks to share chain.
0139691
into
tari-project:development
Description
Coinbase extra field is cached now (locally) and use other miners' coinbase extra when possible from share chain for their shares.
Motivation and Context
Coinbase extra field was not supported to be passed to p2pool before, so in order to let miners pass any extra data they want, we need to be able to do that.
Specs for the format of p2pool coinbase extra field: #56
How Has This Been Tested?
What process can a PR reviewer use to test or verify this change?
Breaking Changes