mirror of https://github.com/hyperledger/besu
Add totalDiffculty to BlockPropagated events. (#97)
* Add totalDiffculty to BlockPropagated events. The chain head block can be contentious with many fork blocks (ommers) propagating on the network. We should add a totalDifficulty to make it easier to see which block is most likely the current head. - added `BlockPropagated` interface in `plugin-api`. - updated `BesuEvents.onBlockPropagated` method to take a `BlockPropagated` instead of a `BlockHeader`. - created `BlockPropagatedSubscriber` in `BlockBroadcaster`. - changed type of `BlockBroadcaster.blockPropagatedSubscribers` from `Consumer<Block>` to `BlockPropagatedSubscriber`. - updated unit tests accordingly to all changes. - updated known hash in `build.gradle` file of `plugin-api`: new value is `4SAeaZIJMsDvUK5Wp2RzU8TlHacslALnM/4yvVhsMtY=` Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>pull/101/head
parent
b4f1becc05
commit
5e819febbd
@ -0,0 +1,36 @@ |
||||
/* |
||||
* Copyright ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.plugin.data; |
||||
|
||||
import org.hyperledger.besu.plugin.Unstable; |
||||
|
||||
/** The minimum set of data for a PropagatedBlockContext. */ |
||||
@Unstable |
||||
public interface PropagatedBlockContext { |
||||
|
||||
/** |
||||
* A {@link BlockHeader} object. |
||||
* |
||||
* @return A {@link BlockHeader} |
||||
*/ |
||||
BlockHeader getBlockHeader(); |
||||
|
||||
/** |
||||
* A scalar value corresponding to the total difficulty. |
||||
* |
||||
* @return A scalar value corresponding to the total difficulty. |
||||
*/ |
||||
Quantity getTotalDifficulty(); |
||||
} |
Loading…
Reference in new issue