whisper, xeth/whisper: surface TTL and hash to the API

This commit is contained in:
Péter Szilágyi
2015-04-21 11:43:11 +03:00
parent 19bc4624ea
commit 7f48eb8737
5 changed files with 25 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package whisper
import (
"bytes"
"testing"
"time"
)
func TestEnvelopeOpen(t *testing.T) {
@ -26,9 +27,12 @@ func TestEnvelopeOpen(t *testing.T) {
if bytes.Compare(opened.Payload, message.Payload) != 0 {
t.Fatalf("payload mismatch: have 0x%x, want 0x%x", opened.Payload, message.Payload)
}
if opened.Sent != message.Sent {
if opened.Sent.Unix() != message.Sent.Unix() {
t.Fatalf("send time mismatch: have %d, want %d", opened.Sent, message.Sent)
}
if opened.TTL/time.Second != DefaultTTL/time.Second {
t.Fatalf("message TTL mismatch: have %v, want %v", opened.TTL, DefaultTTL)
}
if opened.Hash != envelope.Hash() {
t.Fatalf("message hash mismatch: have 0x%x, want 0x%x", opened.Hash, envelope.Hash())