Search in sources :

Example 11 with LedgerHeader

use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.

the class MockedLedgerModule method syncedLedger.

@Provides
@Singleton
Ledger syncedLedger(TimeSupplier timeSupplier) {
    return new Ledger() {

        @Override
        public Optional<PreparedVertex> prepare(LinkedList<PreparedVertex> previous, VerifiedVertex vertex) {
            final long timestamp = vertex.getQC().getTimestampedSignatures().weightedTimestamp();
            final LedgerHeader ledgerHeader = vertex.getParentHeader().getLedgerHeader().updateViewAndTimestamp(vertex.getView(), timestamp);
            return Optional.of(vertex.withHeader(ledgerHeader, timeSupplier.currentTime()).andTxns(vertex.getTxns().stream().<PreparedTxn>map(MockPrepared::new).toList(), Map.of()));
        }
    };
}
Also used : VerifiedVertex(com.radixdlt.hotstuff.bft.VerifiedVertex) LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) PreparedVertex(com.radixdlt.hotstuff.bft.PreparedVertex) Ledger(com.radixdlt.hotstuff.Ledger) LinkedList(java.util.LinkedList) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 12 with LedgerHeader

use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.

the class GetVerticesResponseMessageSerializeTest method get.

private static GetVerticesResponseMessage get() {
    LedgerHeader ledgerHeader = LedgerHeaderMock.get();
    UnverifiedVertex genesisVertex = UnverifiedVertex.createGenesis(ledgerHeader);
    return new GetVerticesResponseMessage(ImmutableList.of(genesisVertex));
}
Also used : LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) UnverifiedVertex(com.radixdlt.hotstuff.UnverifiedVertex)

Example 13 with LedgerHeader

use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.

the class BFTHeaderSerializeTest method get.

private static BFTHeader get() {
    View view = View.of(1234567890L);
    LedgerHeader ledgerHeader = LedgerHeaderMock.get();
    return new BFTHeader(view, HashUtils.random256(), ledgerHeader);
}
Also used : LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) BFTHeader(com.radixdlt.hotstuff.BFTHeader) View(com.radixdlt.hotstuff.bft.View)

Aggregations

LedgerHeader (com.radixdlt.hotstuff.LedgerHeader)13 View (com.radixdlt.hotstuff.bft.View)7 QuorumCertificate (com.radixdlt.hotstuff.QuorumCertificate)6 BFTHeader (com.radixdlt.hotstuff.BFTHeader)5 UnverifiedVertex (com.radixdlt.hotstuff.UnverifiedVertex)5 VerifiedVertex (com.radixdlt.hotstuff.bft.VerifiedVertex)5 HighQC (com.radixdlt.hotstuff.HighQC)4 TimestampedECDSASignatures (com.radixdlt.hotstuff.TimestampedECDSASignatures)4 VoteData (com.radixdlt.hotstuff.VoteData)4 BFTNode (com.radixdlt.hotstuff.bft.BFTNode)4 Provides (com.google.inject.Provides)3 BFTConfiguration (com.radixdlt.hotstuff.BFTConfiguration)3 LedgerProof (com.radixdlt.hotstuff.LedgerProof)3 WeightedRotatingLeaders (com.radixdlt.hotstuff.liveness.WeightedRotatingLeaders)3 ImmutableClassToInstanceMap (com.google.common.collect.ImmutableClassToInstanceMap)2 HashCode (com.google.common.hash.HashCode)2 Inject (com.google.inject.Inject)2 Txn (com.radixdlt.atom.Txn)2 Hasher (com.radixdlt.crypto.Hasher)2 EventDispatcher (com.radixdlt.environment.EventDispatcher)2