swarm/pss: Add same api interface for all Send* methods (#18218)

This commit is contained in:
lash 2018-12-01 07:07:18 +01:00 committed by Viktor Trón
parent 54abb97e3b
commit 085f89172f
2 changed files with 6 additions and 2 deletions

View File

@ -164,6 +164,10 @@ func (pssapi *API) SendSym(symkeyhex string, topic Topic, msg hexutil.Bytes) err
return pssapi.Pss.SendSym(symkeyhex, topic, msg[:]) return pssapi.Pss.SendSym(symkeyhex, topic, msg[:])
} }
func (pssapi *API) SendRaw(addr hexutil.Bytes, topic Topic, msg hexutil.Bytes) error {
return pssapi.Pss.SendRaw(PssAddress(addr), topic, msg[:])
}
func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) { func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) {
topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex) topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex)
return topics, err return topics, err

View File

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