mirror of
https://github.com/Qortal/AT.git
synced 2025-01-30 19:02:14 +00:00
297ccbdaf6
Two new API calls: getOpCodeSteps(OpCode) : int getFeePerStep() : long This allows API to determine cost per "step" and charge more for (say) function opcodes. MachineState knows the balance at the end of each execution round, so now AT's previousBalance is managed by MachineState and added to serialized data. API calls payCurrentBalanceToB and payPreviousBalanceToB are absorbed into payAmountToB, and amounts passed are calculated by FunctionCode instead. Added API call onFinished(long amount, MachineState state) for when AT has finished so API can return remaining funds (amount) to creator. Added API call isFirstOpCodeAfterSleeping() : boolean to replace dodgy test of state.getSteps() == 0 in getRandomUsingTransactionInA(). The API call getCurrentBalance is now used by MachineState to find out AT's balance at the beginning of execution round. After this, MachineState manages the balance until the end of execution, whereby the caller can find out the new balance from MachineState. Corrected some code in FunctionCode to get current balance from MachineState instead in light of above. (Ditto previousBalance). Added MAX_STEPS to MachineState to ATs can be made to sleep if they execute too many steps in one execution round. Added some pre-execution checks to MachineState.execute() to prevent execution in some cases, like already finished, or not enough balance to un-freeze, or not reached required block while sleeping, etc. Unit tests pass, but there are no test for new steps/fee code yet! |
||
---|---|---|
.. | ||
src/org/ciyam/at | ||
tests | ||
.classpath | ||
.project | ||
pom.xml |