|
|
@ -173,7 +173,7 @@ func TestUnmarshalFilterArgs(t *testing.T) { |
|
|
|
s := []byte(`{ |
|
|
|
s := []byte(`{ |
|
|
|
"type":"sym", |
|
|
|
"type":"sym", |
|
|
|
"key":"0x70c87d191324e6712a591f304b4eedef6ad9bb9d", |
|
|
|
"key":"0x70c87d191324e6712a591f304b4eedef6ad9bb9d", |
|
|
|
"signedWith":"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", |
|
|
|
"sig":"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", |
|
|
|
"minPoW":2.34, |
|
|
|
"minPoW":2.34, |
|
|
|
"topics":["0x00000000", "0x007f80ff", "0xff807f00", "0xf26e7779"], |
|
|
|
"topics":["0x00000000", "0x007f80ff", "0xff807f00", "0xf26e7779"], |
|
|
|
"allowP2P":true |
|
|
|
"allowP2P":true |
|
|
@ -191,8 +191,8 @@ func TestUnmarshalFilterArgs(t *testing.T) { |
|
|
|
if f.Key != "0x70c87d191324e6712a591f304b4eedef6ad9bb9d" { |
|
|
|
if f.Key != "0x70c87d191324e6712a591f304b4eedef6ad9bb9d" { |
|
|
|
t.Fatalf("wrong key: %s.", f.Key) |
|
|
|
t.Fatalf("wrong key: %s.", f.Key) |
|
|
|
} |
|
|
|
} |
|
|
|
if f.SignedWith != "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83" { |
|
|
|
if f.Sig != "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83" { |
|
|
|
t.Fatalf("wrong SignedWith: %s.", f.SignedWith) |
|
|
|
t.Fatalf("wrong sig: %s.", f.Sig) |
|
|
|
} |
|
|
|
} |
|
|
|
if f.MinPoW != 2.34 { |
|
|
|
if f.MinPoW != 2.34 { |
|
|
|
t.Fatalf("wrong MinPoW: %f.", f.MinPoW) |
|
|
|
t.Fatalf("wrong MinPoW: %f.", f.MinPoW) |
|
|
@ -229,7 +229,7 @@ func TestUnmarshalPostArgs(t *testing.T) { |
|
|
|
s := []byte(`{ |
|
|
|
s := []byte(`{ |
|
|
|
"type":"sym", |
|
|
|
"type":"sym", |
|
|
|
"ttl":12345, |
|
|
|
"ttl":12345, |
|
|
|
"signWith":"0x70c87d191324e6712a591f304b4eedef6ad9bb9d", |
|
|
|
"sig":"0x70c87d191324e6712a591f304b4eedef6ad9bb9d", |
|
|
|
"key":"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", |
|
|
|
"key":"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", |
|
|
|
"topic":"0xf26e7779", |
|
|
|
"topic":"0xf26e7779", |
|
|
|
"padding":"0x74686973206973206D79207465737420737472696E67", |
|
|
|
"padding":"0x74686973206973206D79207465737420737472696E67", |
|
|
@ -251,8 +251,8 @@ func TestUnmarshalPostArgs(t *testing.T) { |
|
|
|
if a.TTL != 12345 { |
|
|
|
if a.TTL != 12345 { |
|
|
|
t.Fatalf("wrong ttl: %d.", a.TTL) |
|
|
|
t.Fatalf("wrong ttl: %d.", a.TTL) |
|
|
|
} |
|
|
|
} |
|
|
|
if a.SignWith != "0x70c87d191324e6712a591f304b4eedef6ad9bb9d" { |
|
|
|
if a.Sig != "0x70c87d191324e6712a591f304b4eedef6ad9bb9d" { |
|
|
|
t.Fatalf("wrong From: %s.", a.SignWith) |
|
|
|
t.Fatalf("wrong From: %s.", a.Sig) |
|
|
|
} |
|
|
|
} |
|
|
|
if a.Key != "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83" { |
|
|
|
if a.Key != "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83" { |
|
|
|
t.Fatalf("wrong Key: %s.", a.Key) |
|
|
|
t.Fatalf("wrong Key: %s.", a.Key) |
|
|
@ -347,7 +347,7 @@ func TestIntegrationAsym(t *testing.T) { |
|
|
|
var f WhisperFilterArgs |
|
|
|
var f WhisperFilterArgs |
|
|
|
f.Symmetric = false |
|
|
|
f.Symmetric = false |
|
|
|
f.Key = key |
|
|
|
f.Key = key |
|
|
|
f.SignedWith = sigPubKey.String() |
|
|
|
f.Sig = sigPubKey.String() |
|
|
|
f.Topics = make([][]byte, 2) |
|
|
|
f.Topics = make([][]byte, 2) |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
@ -362,7 +362,7 @@ func TestIntegrationAsym(t *testing.T) { |
|
|
|
var p PostArgs |
|
|
|
var p PostArgs |
|
|
|
p.Type = "asym" |
|
|
|
p.Type = "asym" |
|
|
|
p.TTL = 2 |
|
|
|
p.TTL = 2 |
|
|
|
p.SignWith = sig |
|
|
|
p.Sig = sig |
|
|
|
p.Key = dstPubKey.String() |
|
|
|
p.Key = dstPubKey.String() |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
@ -449,7 +449,7 @@ func TestIntegrationSym(t *testing.T) { |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
|
f.MinPoW = DefaultMinimumPoW / 2 |
|
|
|
f.MinPoW = DefaultMinimumPoW / 2 |
|
|
|
f.SignedWith = sigPubKey.String() |
|
|
|
f.Sig = sigPubKey.String() |
|
|
|
f.AllowP2P = false |
|
|
|
f.AllowP2P = false |
|
|
|
|
|
|
|
|
|
|
|
id, err := api.Subscribe(f) |
|
|
|
id, err := api.Subscribe(f) |
|
|
@ -461,7 +461,7 @@ func TestIntegrationSym(t *testing.T) { |
|
|
|
p.Type = "sym" |
|
|
|
p.Type = "sym" |
|
|
|
p.TTL = 1 |
|
|
|
p.TTL = 1 |
|
|
|
p.Key = symKeyID |
|
|
|
p.Key = symKeyID |
|
|
|
p.SignWith = sig |
|
|
|
p.Sig = sig |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
|
p.PowTarget = DefaultMinimumPoW |
|
|
|
p.PowTarget = DefaultMinimumPoW |
|
|
@ -547,7 +547,7 @@ func TestIntegrationSymWithFilter(t *testing.T) { |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[0] = topics[0][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
|
f.Topics[1] = topics[1][:] |
|
|
|
f.MinPoW = DefaultMinimumPoW / 2 |
|
|
|
f.MinPoW = DefaultMinimumPoW / 2 |
|
|
|
f.SignedWith = sigPubKey.String() |
|
|
|
f.Sig = sigPubKey.String() |
|
|
|
f.AllowP2P = false |
|
|
|
f.AllowP2P = false |
|
|
|
|
|
|
|
|
|
|
|
id, err := api.Subscribe(f) |
|
|
|
id, err := api.Subscribe(f) |
|
|
@ -559,7 +559,7 @@ func TestIntegrationSymWithFilter(t *testing.T) { |
|
|
|
p.Type = "sym" |
|
|
|
p.Type = "sym" |
|
|
|
p.TTL = 1 |
|
|
|
p.TTL = 1 |
|
|
|
p.Key = symKeyID |
|
|
|
p.Key = symKeyID |
|
|
|
p.SignWith = sigKeyID |
|
|
|
p.Sig = sigKeyID |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Padding = []byte("test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
|
p.Payload = []byte("extended test string") |
|
|
|
p.PowTarget = DefaultMinimumPoW |
|
|
|
p.PowTarget = DefaultMinimumPoW |
|
|
|