Add first asym implementation

Move test code to pssTest.go
Minor changes
This commit is contained in:
p4u
2019-02-22 21:37:35 +01:00
parent 6005cde258
commit 4d905d5d0b
2 changed files with 37 additions and 6 deletions

View File

@@ -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)
}
}