Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add deposit and delete operation to GVG in signer and fix a few issue #1258

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: add log
alexgao001 committed Dec 5, 2023
commit 10379effe908f6d436525e7d9063986ada1d9a36
8 changes: 7 additions & 1 deletion base/gfspvgmgr/virtual_group_manager.go
Original file line number Diff line number Diff line change
@@ -573,6 +573,7 @@ func (vgm *virtualGroupManager) monitorGVGUsage(gvg *virtualgrouptypes.GlobalVir
return
}
}
log.Infow("found GVG is empty", "GVG", gvg)
var safeDeleteTime int64
val, found := vgm.gvgGCMap.Load(gvg.Id)
if !found {
@@ -581,18 +582,21 @@ func (vgm *virtualGroupManager) monitorGVGUsage(gvg *virtualgrouptypes.GlobalVir
return
}
safeDeleteTime = val.(int64)
log.Infow("GVG will be deleted at", "safe_delete_time", safeDeleteTime)
if curTime < safeDeleteTime {
return
}
log.Infow("start to delete GVG", "GVG", gvg)
var deleteGVGHash string
deleteGVGHash, err = vgm.gfspClient.DeleteGlobalVirtualGroup(context.Background(), &virtualgrouptypes.MsgDeleteGlobalVirtualGroup{
GlobalVirtualGroupId: gvg.Id,
})
if err != nil {
log.Errorw("failed to delete global virtual group", "gvgID", gvg.Id, "txHash", deleteGVGHash, "error", err)
log.Errorw("failed to delete global virtual group", "gvgID", gvg.Id, "tx_hash", deleteGVGHash, "error", err)
return
}
vgm.gvgGCMap.Delete(gvg.Id)
log.Infow("GVG is deleted onchain", "GVG", gvg, "tx_hash", deleteGVGHash)
deleted = true
return
}
@@ -618,12 +622,14 @@ func (vgm *virtualGroupManager) monitorGVGUsage(gvg *virtualgrouptypes.GlobalVir
return
}
}
log.Infow("found GVG need to deposit", "GVG", gvg)
var depositTxHash string
depositTxHash, err = vgm.gfspClient.Deposit(context.Background(), msgDeposit)
if err != nil {
log.Errorw("failed to deposit global virtual group", "gvgID", gvg.Id, "txHash", depositTxHash, "error", err)
return
}
log.Infow("GVG is deposited", "GVG", gvg, "depositTxHash", depositTxHash)
deposited = true
return
}