MCPcopy Create free account
hub / github.com/DEROFDN/Engram / registerAccount

Function registerAccount

functions.go:1254–1361  ·  view source on GitHub ↗

Go Routine for account registration

()

Source from the content-addressed store, hash-verified

1252
1253// Go Routine for account registration
1254func registerAccount() {
1255 session.Domain = "app.register"
1256 if engram.Disk == nil {
1257 resizeWindow(ui.MaxWidth, ui.MaxHeight)
1258 session.Window.SetContent(layoutTransition())
1259 session.Window.SetContent(layoutMain())
1260 session.Domain = "app.main"
1261 return
1262 }
1263
1264 link := widget.NewHyperlinkWithStyle("Cancel", nil, fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
1265 link.OnTapped = func() {
1266 session.Gif.Stop()
1267 session.Gif = nil
1268 closeWallet()
1269 }
1270
1271 title := canvas.NewText("R E G I S T R A T I O N", colors.Green)
1272 title.TextStyle = fyne.TextStyle{Bold: true}
1273 title.TextSize = 16
1274
1275 heading := canvas.NewText("Please wait...", colors.Gray)
1276 heading.TextSize = 22
1277 heading.Alignment = fyne.TextAlignCenter
1278 heading.TextStyle = fyne.TextStyle{Bold: true}
1279
1280 sub := canvas.NewText("This one-time process can take a while.", colors.Gray)
1281 sub.TextSize = 14
1282 sub.Alignment = fyne.TextAlignCenter
1283 sub.TextStyle = fyne.TextStyle{Bold: true}
1284
1285 resizeWindow(ui.MaxWidth, ui.MaxHeight)
1286 session.Window.SetContent(layoutTransition())
1287 session.Window.SetContent(layoutWaiting(title, heading, sub, link))
1288
1289 // Registration PoW
1290 go func() {
1291 var reg_tx *transaction.Transaction
1292 successful_regs := make(chan *transaction.Transaction)
1293 counter := 0
1294 session.RegHashes = 0
1295
1296 for i := 0; i < runtime.GOMAXPROCS(0)-1; i++ {
1297 go func() {
1298 for counter == 0 {
1299 if engram.Disk == nil {
1300 break
1301 } else if engram.Disk.IsRegistered() {
1302 break
1303 }
1304
1305 lreg_tx := engram.Disk.GetRegistrationTX()
1306 hash := lreg_tx.GetHash()
1307 session.RegHashes++
1308
1309 if hash[0] == 0 && hash[1] == 0 && hash[2] == 0 {
1310 successful_regs <- lreg_tx
1311 counter++

Callers 1

loginFunction · 0.85

Calls 6

resizeWindowFunction · 0.85
layoutTransitionFunction · 0.85
layoutMainFunction · 0.85
closeWalletFunction · 0.85
layoutWaitingFunction · 0.85
layoutDashboardFunction · 0.85

Tested by

no test coverage detected