mirror of
https://github.com/arnaucube/go-dvote.git
synced 2026-02-28 05:26:46 +01:00
Add first asym implementation
Move test code to pssTest.go Minor changes
This commit is contained in:
@@ -2,7 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
swarm "github.com/vocdoni/go-dvote/net/swarm"
|
||||
)
|
||||
|
||||
@@ -13,5 +16,20 @@ func main() {
|
||||
fmt.Printf("%v\n", err)
|
||||
return
|
||||
}
|
||||
sn.Test()
|
||||
key := "randomkey0"
|
||||
sn.PssSub("sym", key, "vocdoni_test", "")
|
||||
|
||||
go func() {
|
||||
for {
|
||||
msg := <-sn.PssTopics["vocdoni_test"].Delivery
|
||||
fmt.Printf("Pss received: %s\n", msg)
|
||||
}
|
||||
}()
|
||||
|
||||
hostname, _ := os.Hostname()
|
||||
for {
|
||||
err := sn.PssPub("sym", key, "vocdoni_test", fmt.Sprintf("Hello world from %s", hostname), "")
|
||||
log.Info("pss sent", "err", err)
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user