From 18f679e6ebe0887c777abb1d108057c992c171dd Mon Sep 17 00:00:00 2001 From: catbref Date: Tue, 7 Apr 2020 17:00:01 +0100 Subject: [PATCH] MachineState's initial previousBalance is set to AT's balance at deployment --- Java/src/main/java/org/ciyam/at/MachineState.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Java/src/main/java/org/ciyam/at/MachineState.java b/Java/src/main/java/org/ciyam/at/MachineState.java index a8ce0b6..103e48a 100644 --- a/Java/src/main/java/org/ciyam/at/MachineState.java +++ b/Java/src/main/java/org/ciyam/at/MachineState.java @@ -237,7 +237,7 @@ public class MachineState { this.frozenBalance = null; this.isFinished = false; this.hadFatalError = false; - this.previousBalance = 0; + this.previousBalance = this.api.getCurrentBalance(this); // Initial previousBalance is deployment balance // If we have a minimum activation amount then create AT in frozen state, requiring that amount to unfreeze. // If creator also sends funds with creation then AT will unfreeze on first call. @@ -409,8 +409,7 @@ public class MachineState { this.currentBalance = currentBalance; } - // For FunctionCode use - /* package */ long getPreviousBalance() { + public long getPreviousBalance() { return this.previousBalance; }