Skip to content
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

Integrating feature into dev: I40 transaction fee distribution #45

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion crates/ethcore/src/engines/hbbft/hbbft_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ impl HoneyBadgerBFT {
.map(|(_, c)| c.timestamp)
.sorted();

// todo: use timstamps for calculating negative score.
// https://github.com/DMDcoin/diamond-node/issues/37

let timestamp = match timestamps.iter().nth(timestamps.len() / 2) {
Some(t) => t.clone(),
None => {
Expand All @@ -481,9 +484,19 @@ impl HoneyBadgerBFT {
.write()
.insert(batch.epoch, random_number);

if let Some(header) = client.create_pending_block_at(batch_txns, timestamp, batch.epoch) {
if let Some(mut header) = client.create_pending_block_at(batch_txns, timestamp, batch.epoch)
{
let block_num = header.number();
let hash = header.bare_hash();
if let Some(reward_contract_address) = self.params.block_reward_contract_address {
header.set_author(reward_contract_address);
} else {
warn!(
"Creating block with no blockRewardContractAddress {}",
block_num
);
}

trace!(target: "consensus", "Sending signature share of {} for block {}", hash, block_num);
let step = match self
.sealing
Expand Down Expand Up @@ -1515,6 +1528,8 @@ impl Engine<EthereumMachine> for HoneyBadgerBFT {
// only if no block reward skips are defined for this block.
let header_number = block.header.number();

block.header.set_author(address);

if self
.params
.should_do_block_reward_contract_call(header_number)
Expand Down
2 changes: 1 addition & 1 deletion crates/ethcore/src/engines/hbbft/hbbft_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl HbbftState {

if let Some(latest_block) = client.block_number(BlockId::Latest) {
if honey_badger.epoch() != latest_block + 1 {
info!(target: "consensus", "Detected an attempt to send a hbbft contribution for block {} before the previous block was imported to the chain.", honey_badger.epoch());
info!(target: "consensus", "Detected an attempt to send a hbbft contribution for block {} before the previous block was imported to the chain. (latest block: {})", honey_badger.epoch(), latest_block);
return None;
}
}
Expand Down
Loading