Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 1407dd4

Browse files
committed
swarm/pss: Add same api interface for all Send* methods (#18218)
1 parent cee1eb2 commit 1407dd4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

swarm/pss/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ func (pssapi *API) SendSym(symkeyhex string, topic Topic, msg hexutil.Bytes) err
164164
return pssapi.Pss.SendSym(symkeyhex, topic, msg[:])
165165
}
166166

167+
func (pssapi *API) SendRaw(addr hexutil.Bytes, topic Topic, msg hexutil.Bytes) error {
168+
return pssapi.Pss.SendRaw(PssAddress(addr), topic, msg[:])
169+
}
170+
167171
func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) {
168172
topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex)
169173
return topics, err

swarm/pss/pss_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ func testSendRaw(t *testing.T) {
10641064

10651065
// send and verify delivery
10661066
lmsg := []byte("plugh")
1067-
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, lmsg)
1067+
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, hexutil.Encode(lmsg))
10681068
if err != nil {
10691069
t.Fatal(err)
10701070
}
@@ -1077,7 +1077,7 @@ func testSendRaw(t *testing.T) {
10771077
t.Fatalf("test message (left) timed out: %v", cerr)
10781078
}
10791079
rmsg := []byte("xyzzy")
1080-
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, rmsg)
1080+
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, hexutil.Encode(rmsg))
10811081
if err != nil {
10821082
t.Fatal(err)
10831083
}

0 commit comments

Comments
 (0)