use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_CHUNK_TRANSACTION_ID in project hedera-services by hashgraph.
the class ScheduleExecutionSpecs method scheduledSubmitFailedWithInvalidChunkTxnIdStillPaysServiceFeeButHasNoImpact.
private HapiApiSpec scheduledSubmitFailedWithInvalidChunkTxnIdStillPaysServiceFeeButHasNoImpact() {
String immutableTopic = "XXX";
String validSchedule = "withValidChunkTxnId";
String invalidSchedule = "withInvalidChunkTxnId";
String schedulePayer = "somebody";
String successTxn = "good", failedTxn = "bad";
AtomicReference<Map<AccountID, Long>> successFeesObs = new AtomicReference<>();
AtomicReference<Map<AccountID, Long>> failureFeesObs = new AtomicReference<>();
AtomicReference<TransactionID> initialTxnId = new AtomicReference<>();
AtomicReference<TransactionID> irrelevantTxnId = new AtomicReference<>();
return defaultHapiSpec("ScheduledSubmitFailedWithInvalidChunkTxnIdStillPaysServiceFeeButHasNoImpact").given(createTopic(immutableTopic), cryptoCreate(schedulePayer)).when(withOpContext((spec, opLog) -> {
var subOp = usableTxnIdNamed(successTxn).payerId(schedulePayer);
var secondSubOp = usableTxnIdNamed("wontWork").payerId(schedulePayer);
allRunFor(spec, subOp, secondSubOp);
initialTxnId.set(spec.registry().getTxnId(successTxn));
irrelevantTxnId.set(spec.registry().getTxnId("wontWork"));
}), sourcing(() -> scheduleCreate(validSchedule, submitMessageTo(immutableTopic).chunkInfo(3, 1, scheduledVersionOf(initialTxnId.get()))).txnId(successTxn).logged().signedBy(schedulePayer)), getTopicInfo(immutableTopic).hasSeqNo(1L), getTxnRecord(successTxn).scheduled().logged().revealingDebitsTo(successFeesObs::set), sourcing(() -> scheduleCreate(invalidSchedule, submitMessageTo(immutableTopic).chunkInfo(3, 1, scheduledVersionOf(irrelevantTxnId.get()))).designatingPayer(schedulePayer).via(failedTxn).logged().signedBy(DEFAULT_PAYER, schedulePayer))).then(getTopicInfo(immutableTopic).hasSeqNo(1L), getTxnRecord(failedTxn).scheduled().hasPriority(recordWith().status(INVALID_CHUNK_TRANSACTION_ID)).revealingDebitsTo(failureFeesObs::set), assertionsHold((spec, opLog) -> Assertions.assertEquals(successFeesObs.get(), failureFeesObs.get())));
}
Aggregations