use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method cryptoAddLiveHashPersist.
@Test
void cryptoAddLiveHashPersist() {
Transaction transaction = cryptoAddLiveHashTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
CryptoAddLiveHashTransactionBody cryptoAddLiveHashTransactionBody = transactionBody.getCryptoAddLiveHash();
TransactionRecord record = transactionRecordSuccess(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
var dbTransaction = getDbTransaction(record.getConsensusTimestamp());
LiveHash dbLiveHash = liveHashRepository.findById(dbTransaction.getConsensusTimestamp()).get();
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(), () -> assertCryptoTransfers(3), () -> assertEquals(1, liveHashRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertArrayEquals(cryptoAddLiveHashTransactionBody.getLiveHash().getHash().toByteArray(), dbLiveHash.getLivehash()));
}
use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method insertCryptoAddLiveHash.
private void insertCryptoAddLiveHash(long consensusTimestamp, CryptoAddLiveHashTransactionBody transactionBody) {
if (entityProperties.getPersist().isClaims()) {
byte[] liveHash = DomainUtils.toBytes(transactionBody.getLiveHash().getHash());
entityListener.onLiveHash(new LiveHash(consensusTimestamp, liveHash));
}
}
use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.
the class LiveHashRepositoryTest method save.
@Test
void save() {
LiveHash liveHash = new LiveHash();
liveHash.setConsensusTimestamp(1L);
liveHash.setLivehash("some live hash".getBytes());
liveHash = liveHashRepository.save(liveHash);
assertThat(liveHashRepository.findById(liveHash.getId())).get().isEqualTo(liveHash);
}
use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.
the class SqlEntityListenerTest method onLiveHash.
@Test
void onLiveHash() {
// given
LiveHash expectedLiveHash = new LiveHash(20L, "live hash".getBytes());
// when
sqlEntityListener.onLiveHash(expectedLiveHash);
completeFileAndCommit();
// then
assertThat(liveHashRepository.findAll()).containsExactlyInAnyOrder(expectedLiveHash);
}
Aggregations