use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method createAccount.
private void createAccount() {
Transaction createTransaction = cryptoCreateTransaction();
TransactionBody createTransactionBody = getTransactionBody(createTransaction);
TransactionRecord createRecord = transactionRecordSuccess(createTransactionBody);
parseRecordItemAndCommit(new RecordItem(createTransaction, createRecord));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method unknownTransactionResult.
@Test
void unknownTransactionResult() {
int unknownResult = -1000;
Transaction transaction = cryptoCreateTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody, unknownResult);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertThat(transactionRepository.findAll()).hasSize(1).extracting(com.hedera.mirror.common.domain.transaction.Transaction::getResult).containsOnly(unknownResult);
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method testRawBytes.
private void testRawBytes(Transaction transaction, byte[] expectedBytes) {
// given
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecordSuccess(transactionBody);
// when
parseRecordItemAndCommit(new RecordItem(transaction, record));
// then
var dbTransaction = getDbTransaction(record.getConsensusTimestamp());
assertArrayEquals(expectedBytes, dbTransaction.getTransactionBytes());
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method samePayerAndUpdateAccount.
/**
* Github issue #483
*/
@Test
void samePayerAndUpdateAccount() {
Transaction transaction = cryptoUpdateTransaction(accountId1);
TransactionBody transactionBody = getTransactionBody(transaction);
transactionBody = TransactionBody.newBuilder().mergeFrom(transactionBody).setTransactionID(Utility.getTransactionId(accountId1)).build();
transaction = Transaction.newBuilder().setSignedTransactionBytes(SignedTransaction.newBuilder().setBodyBytes(transactionBody.toByteString()).build().toByteString()).build();
TransactionRecord record = transactionRecordSuccess(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertThat(transactionRepository.findById(DomainUtils.timestampInNanosMax(record.getConsensusTimestamp()))).get().extracting(com.hedera.mirror.common.domain.transaction.Transaction::getPayerAccountId, com.hedera.mirror.common.domain.transaction.Transaction::getEntityId).containsOnly(EntityId.of(accountId1));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method cryptoDeleteSuccessfulTransaction.
@Test
void cryptoDeleteSuccessfulTransaction() {
// first create the account
createAccount();
Entity dbAccountEntityBefore = getEntity(EntityId.of(accountId1));
// now delete
Transaction transaction = cryptoDeleteTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecordSuccess(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
Entity dbAccountEntity = getTransactionEntity(record.getConsensusTimestamp());
assertAll(() -> assertEquals(2, transactionRepository.count()), () -> assertEntities(EntityId.of(accountId1)), // 3 + 3 fee transfers with one transfer per account
() -> assertCryptoTransfers(6), () -> assertCryptoTransaction(transactionBody, record), () -> assertThat(dbAccountEntity).isNotNull().returns(true, Entity::getDeleted).returns(DomainUtils.timestampInNanosMax(record.getConsensusTimestamp()), Entity::getTimestampLower).usingRecursiveComparison().ignoringFields("deleted", "timestampRange").isEqualTo(dbAccountEntityBefore));
}
Aggregations