Search in sources :

Example 51 with Difficulty

use of org.hyperledger.besu.ethereum.core.Difficulty in project besu by hyperledger.

the class StatusMessageTest method toStringHasExpectedInfo.

@Test
public void toStringHasExpectedInfo() {
    final int version = EthProtocol.EthVersion.V64;
    final BigInteger networkId = BigInteger.ONE;
    final Difficulty td = Difficulty.of(1000L);
    final Hash bestHash = randHash(1L);
    final Hash genesisHash = randHash(2L);
    final ForkId forkId = new ForkId(Bytes.fromHexString("0xa00bc334"), 0L);
    final MessageData msg = StatusMessage.create(version, networkId, td, bestHash, genesisHash, forkId);
    final StatusMessage copy = new StatusMessage(msg.getData());
    final String copyToString = copy.toString();
    assertThat(copyToString).contains("bestHash=" + bestHash);
    assertThat(copyToString).contains("genesisHash=" + genesisHash);
}
Also used : Difficulty(org.hyperledger.besu.ethereum.core.Difficulty) MessageData(org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData) BigInteger(java.math.BigInteger) ForkId(org.hyperledger.besu.ethereum.eth.manager.ForkId) Hash(org.hyperledger.besu.datatypes.Hash) Test(org.junit.Test)

Aggregations

Difficulty (org.hyperledger.besu.ethereum.core.Difficulty)51 Test (org.junit.Test)29 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)20 Block (org.hyperledger.besu.ethereum.core.Block)16 Hash (org.hyperledger.besu.datatypes.Hash)14 RespondingEthPeer (org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer)9 BigInteger (java.math.BigInteger)8 BlockHeaderTestFixture (org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture)8 Transaction (org.hyperledger.besu.ethereum.core.Transaction)7 List (java.util.List)6 Optional (java.util.Optional)6 Wei (org.hyperledger.besu.datatypes.Wei)6 ProtocolContext (org.hyperledger.besu.ethereum.ProtocolContext)6 MutableBlockchain (org.hyperledger.besu.ethereum.chain.MutableBlockchain)6 ArrayList (java.util.ArrayList)5 Bytes (org.apache.tuweni.bytes.Bytes)5 Address (org.hyperledger.besu.datatypes.Address)5 Collections (java.util.Collections)4 MergeContext (org.hyperledger.besu.consensus.merge.MergeContext)4 NewBlockMessage (org.hyperledger.besu.ethereum.eth.messages.NewBlockMessage)4