Search in sources :

Example 1 with RecordStreamObject

use of com.hedera.services.stream.RecordStreamObject in project hedera-services by hashgraph.

the class TxnAwareRecordsHistorian method finalizeChildrenVerbosely.

private void finalizeChildrenVerbosely(final int sigNum, final List<InProgressChildRecord> childRecords, final List<RecordStreamObject> recordObjs, final Instant consensusNow, final ExpirableTxnRecord.Builder topLevel) {
    final var parentId = topLevel.getTxnId();
    for (int i = 0, n = childRecords.size(); i < n; i++) {
        final var inProgress = childRecords.get(i);
        final var child = inProgress.recordBuilder();
        if (child.shouldNotBeExternalized()) {
            continue;
        }
        topLevel.excludeHbarChangesFrom(child);
        child.setTxnId(parentId.withNonce(nextNonce++));
        final var childConsTime = nonNegativeNanosOffset(consensusNow, sigNum * (i + 1));
        child.setConsensusTime(RichInstant.fromJava(childConsTime));
        /* Mirror node team prefers we only set a parent consensus time for records that FOLLOW
			 * the top-level transaction. This might change for future use cases. */
        if (sigNum > 0) {
            child.setParentConsensusTime(consensusNow);
        }
        final var synthTxn = synthFrom(inProgress.syntheticBody(), child);
        final var synthHash = noThrowSha384HashOf(synthTxn.getSignedTransactionBytes().toByteArray());
        child.setTxnHash(synthHash);
        recordObjs.add(new RecordStreamObject(child.build(), synthTxn, childConsTime));
    }
}
Also used : RecordStreamObject(com.hedera.services.stream.RecordStreamObject)

Example 2 with RecordStreamObject

use of com.hedera.services.stream.RecordStreamObject in project hedera-services by hashgraph.

the class RecordParser method parseV5From.

public static List<RecordStreamObject> parseV5From(File fin) {
    final List<RecordStreamObject> rsos = new ArrayList<>();
    /* NOTE - until release 0.23.x the HAPI version in the file header was left at { 5, 0, 11, 0 }
		* so for forensics on earlier records this may need a different StreamType implementation. */
    final Iterator iter = LinkedObjectStreamUtilities.parseStreamFile(fin, RELEASE_023x_STREAM_TYPE);
    for (; iter.hasNext(); ) {
        final var next = iter.next();
        if (next instanceof RecordStreamObject) {
            rsos.add((RecordStreamObject) next);
        }
    }
    return rsos;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) RecordStreamObject(com.hedera.services.stream.RecordStreamObject)

Example 3 with RecordStreamObject

use of com.hedera.services.stream.RecordStreamObject in project hedera-services by hashgraph.

the class RecordStreamCmpTest method registerConstructables.

private void registerConstructables() throws ConstructableRegistryException {
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(Hash.class, Hash::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(RecordStreamObject.class, RecordStreamObject::new));
}
Also used : RecordStreamObject(com.hedera.services.stream.RecordStreamObject) Hash(com.swirlds.common.crypto.Hash) ClassConstructorPair(com.swirlds.common.constructable.ClassConstructorPair)

Aggregations

RecordStreamObject (com.hedera.services.stream.RecordStreamObject)3 ClassConstructorPair (com.swirlds.common.constructable.ClassConstructorPair)1 Hash (com.swirlds.common.crypto.Hash)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1