use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractUpdateAllToExistingInvalidTransaction.
@ParameterizedTest
@EnumSource(value = ContractIdType.class)
void contractUpdateAllToExistingInvalidTransaction(ContractIdType contractIdType) {
SetupResult setupResult = setupContract(CONTRACT_ID, contractIdType, true, true);
Transaction transaction = contractUpdateAllTransaction(setupResult.protoContractId, true);
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE, ContractTransactionType.UPDATE);
RecordItem recordItem = new RecordItem(transaction, record);
parseRecordItemAndCommit(recordItem);
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertThat(contractRepository.findAll()).containsExactly(setupResult.contract));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method cryptoTransferFailedTransaction.
@Test
void cryptoTransferFailedTransaction() {
entityProperties.getPersist().setCryptoTransferAmounts(true);
// make the transfers
Transaction transaction = cryptoTransferTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody, ResponseCodeEnum.INVALID_ACCOUNT_ID);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(), () -> assertCryptoTransfers(3), () -> assertEquals(0, nonFeeTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord 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.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method cryptoTransferFailedTransactionErrata.
@Test
void cryptoTransferFailedTransactionErrata() {
entityProperties.getPersist().setCryptoTransferAmounts(true);
Transaction transaction = cryptoTransferTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = buildTransactionRecord(r -> {
for (int i = 0; i < additionalTransfers.length; i++) {
// Add non-fee transfers to record
var accountAmount = accountAmount(additionalTransfers[i], additionalTransferAmounts[i]);
r.getTransferListBuilder().addAccountAmounts(accountAmount);
}
}, transactionBody, ResponseCodeEnum.INVALID_ACCOUNT_ID.getNumber());
var recordItem = new RecordItem(transaction, record);
parseRecordItemAndCommit(recordItem);
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(), () -> assertEquals(4, cryptoTransferRepository.count(), "Node, network fee & errata"), () -> assertEquals(0, nonFeeTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> {
for (int i = 0; i < additionalTransfers.length; i++) {
var id = new CryptoTransfer.Id(additionalTransferAmounts[i], recordItem.getConsensusTimestamp(), additionalTransfers[i]);
assertThat(cryptoTransferRepository.findById(id)).get().extracting(CryptoTransfer::getErrata).isEqualTo(ErrataType.DELETE);
}
});
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerCryptoTest method cryptoDeleteLiveHash.
@Test
void cryptoDeleteLiveHash() {
Transaction transactionAddLiveHash = cryptoAddLiveHashTransaction();
parseRecordItemAndCommit(new RecordItem(transactionAddLiveHash, transactionRecordSuccess(getTransactionBody(transactionAddLiveHash))));
// now delete the live hash
Transaction transaction = cryptoDeleteLiveHashTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
CryptoDeleteLiveHashTransactionBody deleteLiveHashTransactionBody = transactionBody.getCryptoDeleteLiveHash();
TransactionRecord record = transactionRecordSuccess(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertEquals(2, transactionRepository.count()), () -> assertEntities(), () -> assertCryptoTransfers(6), () -> assertEquals(1, liveHashRepository.count()), () -> assertTransactionAndRecord(transactionBody, record));
}
Aggregations