func NewTransaction() { if betternode.CountNodes() == 0 { fmt.Println("Unable to initiate transaction: No nodes connected.") return } from := betternode.RandomNode() to := betternode.RandomNode() for i := 1; i < 1000; i++ { if to != from { break } to = betternode.RandomNode() } log.Message("NewTransmission()") t := betternode.NewTransaction( <-idgen, mapping[to], hops, "Lorem ipsum", fine, ceil, RoundId, ) // Send transaction log.Message("NewTransmission() 1") betternode.SendTransaction(t, from) log.Message("NewTransmission() 2") database.Insert(t) log.Message("NewTransmission() 3") transaction.Add <- t log.Message("NewTransmission() 4") }
func printInfo() { gos := runtime.NumGoroutine() ths := runtime.GOMAXPROCS(0) cpu := runtime.NumCPU() nds := betternode.CountNodes() fmt.Printf("Go Routines:\t%d\n"+ "Threads:\t%d\n"+ "Cores:\t\t%d\n"+ "Connected:\t%d\n", gos, ths, cpu, nds) }