Initial attempt at adding "sleep until message" functionality to DOGE ACCTv2.

This commit is contained in:
CalDescent 2021-08-02 20:08:53 +01:00
parent 797dff4752
commit a1c61a1146

View File

@ -88,7 +88,7 @@ public class DogecoinACCTv2 implements ACCT {
private static final Logger LOGGER = LogManager.getLogger(DogecoinACCTv2.class); private static final Logger LOGGER = LogManager.getLogger(DogecoinACCTv2.class);
public static final String NAME = DogecoinACCTv2.class.getSimpleName(); public static final String NAME = DogecoinACCTv2.class.getSimpleName();
public static final byte[] CODE_BYTES_HASH = HashCode.fromString("0eb49b0313ff3855a29d860c2a8203faa2ef62e28ea30459321f176079cfa3a6").asBytes(); // SHA256 of AT code bytes public static final byte[] CODE_BYTES_HASH = HashCode.fromString("6fff38d6eeb06568a9c879c5628527730319844aa0de53f5f4ffab5506efe885").asBytes(); // SHA256 of AT code bytes
public static final int SECRET_LENGTH = 32; public static final int SECRET_LENGTH = 32;
@ -356,6 +356,9 @@ public class DogecoinACCTv2 implements ACCT {
/* Transaction processing loop */ /* Transaction processing loop */
labelTradeTxnLoop = codeByteBuffer.position(); labelTradeTxnLoop = codeByteBuffer.position();
/* Sleep until message arrives */
codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(QortalFunctionCode.SLEEP_UNTIL_MESSAGE.value, addrLastTxnTimestamp));
// Find next transaction (if any) to this AT since the last one (referenced by addrLastTxnTimestamp) // Find next transaction (if any) to this AT since the last one (referenced by addrLastTxnTimestamp)
codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(FunctionCode.PUT_TX_AFTER_TIMESTAMP_INTO_A, addrLastTxnTimestamp)); codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(FunctionCode.PUT_TX_AFTER_TIMESTAMP_INTO_A, addrLastTxnTimestamp));
// If no transaction found, A will be zero. If A is zero, set addrResult to 1, otherwise 0. // If no transaction found, A will be zero. If A is zero, set addrResult to 1, otherwise 0.
@ -462,6 +465,9 @@ public class DogecoinACCTv2 implements ACCT {
/* Transaction processing loop */ /* Transaction processing loop */
labelRedeemTxnLoop = codeByteBuffer.position(); labelRedeemTxnLoop = codeByteBuffer.position();
/* Sleep until message arrives */
codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(QortalFunctionCode.SLEEP_UNTIL_MESSAGE.value, addrLastTxnTimestamp));
// Find next transaction to this AT since the last one (if any) // Find next transaction to this AT since the last one (if any)
codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(FunctionCode.PUT_TX_AFTER_TIMESTAMP_INTO_A, addrLastTxnTimestamp)); codeByteBuffer.put(OpCode.EXT_FUN_DAT.compile(FunctionCode.PUT_TX_AFTER_TIMESTAMP_INTO_A, addrLastTxnTimestamp));
// If no transaction found, A will be zero. If A is zero, set addrComparator to 1, otherwise 0. // If no transaction found, A will be zero. If A is zero, set addrComparator to 1, otherwise 0.