mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/swarm/swarm-smoke-pss: add raw send msg
This commit is contained in:
parent
550c60e410
commit
d2a459f3af
2 changed files with 21 additions and 1 deletions
|
|
@ -115,6 +115,12 @@ func main() {
|
||||||
Usage: "PSS: send and receive multiple messages across random nodes using symmetric encryption",
|
Usage: "PSS: send and receive multiple messages across random nodes using symmetric encryption",
|
||||||
Action: wrapCliCommand("sym", pssSymCheck),
|
Action: wrapCliCommand("sym", pssSymCheck),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "raw",
|
||||||
|
Aliases: []string{"r"},
|
||||||
|
Usage: "PSS: send and receive multiple raw messages across random nodes",
|
||||||
|
Action: wrapCliCommand("sym", pssRawCheck),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(cli.FlagsByName(app.Flags))
|
sort.Sort(cli.FlagsByName(app.Flags))
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,11 @@ func pssAsymCheck(ctx *cli.Context, tuid string) error {
|
||||||
func pssSymCheck(ctx *cli.Context, tuid string) error {
|
func pssSymCheck(ctx *cli.Context, tuid string) error {
|
||||||
return pssCheck(ctx, tuid, "sym", pssSymDo)
|
return pssCheck(ctx, tuid, "sym", pssSymDo)
|
||||||
}
|
}
|
||||||
|
func pssRawCheck(ctx *cli.Context, tuid string) error {
|
||||||
|
return pssCheck(ctx, tuid, "raw", pssRawDo)
|
||||||
|
}
|
||||||
|
|
||||||
func pssCheck(ctx *cli.Context, tuid string, tag string, fn pssTestFn) error {
|
func pssCheck(ctx *cli.Context, tuid string, tag string, fn pssTestFn) error {
|
||||||
|
|
||||||
// use input seed if it has been set
|
// use input seed if it has been set
|
||||||
if inputSeed != 0 {
|
if inputSeed != 0 {
|
||||||
seed = inputSeed
|
seed = inputSeed
|
||||||
|
|
@ -275,6 +277,18 @@ func pssAsymDo(ctx *cli.Context, session *pssSession, tuid string) error {
|
||||||
return session.waitForMsg()
|
return session.waitForMsg()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func pssRawDo(ctx *cli.Context, session *pssSession, tuid string) error {
|
||||||
|
j := session.genJob()
|
||||||
|
|
||||||
|
err := j.sender.client.Call(nil, "pss_sendRaw", hexutil.Encode(j.receiver.addr), session.topic, hexutil.Encode(j.msg))
|
||||||
|
if err != nil {
|
||||||
|
log.Error("error sending raw message", "err", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return session.waitForMsg()
|
||||||
|
}
|
||||||
|
|
||||||
func toMsgIdx(msg []byte) string {
|
func toMsgIdx(msg []byte) string {
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write(msg)
|
h.Write(msg)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue