mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
whisper: rlp test updated
This commit is contained in:
parent
03ef121919
commit
556992d503
2 changed files with 6 additions and 2 deletions
|
|
@ -330,13 +330,13 @@ func TestRlpEncode(t *testing.T) {
|
||||||
t.Fatalf("wrapped with zero key, seed: %d.", seed)
|
t.Fatalf("wrapped with zero key, seed: %d.", seed)
|
||||||
}
|
}
|
||||||
|
|
||||||
rlpEncoded, err := rlp.EncodeToBytes(env)
|
raw, err := rlp.EncodeToBytes(env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("RLP encode failed: %s.", err)
|
t.Fatalf("RLP encode failed: %s.", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var decoded Envelope
|
var decoded Envelope
|
||||||
err = decoded.DecodeBytes(rlpEncoded)
|
rlp.DecodeBytes(raw, &decoded)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("RLP decode failed: %s.", err)
|
t.Fatalf("RLP decode failed: %s.", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,10 @@ func (w *Whisper) SendP2PMessage(peerID []byte, envelope *Envelope) error {
|
||||||
return p2p.Send(p.ws, p2pCode, envelope)
|
return p2p.Send(p.ws, p2pCode, envelope)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *Whisper) SendP2PDirect(peer *Peer, envelope *Envelope) error {
|
||||||
|
return p2p.Send(peer.ws, p2pCode, envelope)
|
||||||
|
}
|
||||||
|
|
||||||
// NewIdentity generates a new cryptographic identity for the client, and injects
|
// NewIdentity generates a new cryptographic identity for the client, and injects
|
||||||
// it into the known identities for message decryption.
|
// it into the known identities for message decryption.
|
||||||
func (w *Whisper) NewIdentity() *ecdsa.PrivateKey {
|
func (w *Whisper) NewIdentity() *ecdsa.PrivateKey {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue