Skip to content

Commit

Permalink
added class documentation for ScheduleReadyForExecution
Browse files Browse the repository at this point in the history
Signed-off-by: abhishek-hedera <[email protected]>
  • Loading branch information
abhishek-hedera committed Apr 27, 2021
1 parent 40d3a35 commit 1f12ec2
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@

import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK;

/**
* Defines a class to handle scheduled transaction execution
* once the scheduled transaction is signed by the required
* number of parties.
*
* @author Michael Tinker
* @author Abhishek Pandey
*/
public class ScheduleReadyForExecution {
protected final ScheduleStore store;
protected final TransactionContext txnCtx;
Expand All @@ -38,14 +46,22 @@ public class ScheduleReadyForExecution {
this.txnCtx = context;
}

/**
* Given a ScheduleId, check if the underlying transaction
* is already executed/deleted before attempting to execute.
*
* @param id The id of the scheduled transaction.
*
* @return the response code from executing the inner scheduled transaction
*/
ResponseCodeEnum processExecution(ScheduleID id) throws InvalidProtocolBufferException {
var executionStatus = store.markAsExecuted(id);
final var executionStatus = store.markAsExecuted(id);
if (executionStatus != OK) {
return executionStatus;
}

var schedule = store.get(id);
var transaction = schedule.asSignedTxn();
final var schedule = store.get(id);
final var transaction = schedule.asSignedTxn();
txnCtx.trigger(
new TriggeredTxnAccessor(
transaction.toByteArray(),
Expand Down

0 comments on commit 1f12ec2

Please sign in to comment.