Check issue content in executor check command
@@ -40,6 +40,7 @@ import (
type ICON1AccountInfo struct {
BlockHeight int64 `json:"blockHeight"`
Status status `json:"status"`
+ Issue issue `json:"issue"`
Accounts map[string]account `json:"accounts"`
}
@@ -67,6 +68,28 @@ func (s *status) Check(wss state.WorldSnapshot, extState containerdb.ObjectStore
}
}
+type issue struct {
+ IssuedICX *big.Int `json:"issuedICX"`
+ PrevIssuedICX *big.Int `json:"prevIssuedICX"`
+ OverIssuedIScore *big.Int `json:"overIssuedIScore"`
+}
+
+func (i *issue) Check(extState containerdb.ObjectStoreState) {
+ if i == nil {
+ return
+ }
+ value, err := extState.Get(icstate.IssueKey)
+ if err != nil || value == nil {
+ return
+ }
+ is := icstate.ToIssue(value)
+ if is == nil || i.IssuedICX.Cmp(is.TotalReward()) != 0 ||
+ i.PrevIssuedICX.Cmp(is.PrevTotalReward()) != 0 ||
+ i.OverIssuedIScore.Cmp(is.OverIssuedIScore()) != 0 {
+ fmt.Printf("Failed Issue: icon1(%+v) icon2(%+v)\n", i, is)
+ }
+}
+
type account struct {
Balance *big.Int `json:"balance"`
Stake *big.Int `json:"stake,omitempty"`
@@ -237,6 +260,7 @@ func CheckState(icon1 *ICON1AccountInfo, wss state.WorldSnapshot, address string
extReward := getObjectStoreState(wss.Database(), hashes[4], icreward.NewObjectImpl)
icon1.Status.Check(wss, extState)
+ icon1.Issue.Check(extState)
count := 0
lost := new(big.Int)
