mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Swarm, pss: fixed err ineffs in pss_test.go.
This commit is contained in:
parent
8daf486355
commit
e9dc721c7b
1 changed files with 23 additions and 23 deletions
|
|
@ -164,7 +164,7 @@ func TestCache(t *testing.T) {
|
||||||
to, _ := hex.DecodeString("08090a0b0c0d0e0f1011121314150001020304050607161718191a1b1c1d1e1f")
|
to, _ := hex.DecodeString("08090a0b0c0d0e0f1011121314150001020304050607161718191a1b1c1d1e1f")
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctx)
|
keys, _ := wapi.NewKeyPair(ctx)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, err := w.GetPrivateKey(keys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
@ -183,21 +183,21 @@ func TestCache(t *testing.T) {
|
||||||
PoW: defaultWhisperPoW,
|
PoW: defaultWhisperPoW,
|
||||||
Payload: data,
|
Payload: data,
|
||||||
}
|
}
|
||||||
woutmsg, err := whisper.NewSentMessage(wparams)
|
woutmsg, _ := whisper.NewSentMessage(wparams)
|
||||||
env, err := woutmsg.Wrap(wparams)
|
env, _ := woutmsg.Wrap(wparams)
|
||||||
msg := &PssMsg{
|
msg := &PssMsg{
|
||||||
Payload: env,
|
Payload: env,
|
||||||
To: to,
|
To: to,
|
||||||
}
|
}
|
||||||
wparams.Payload = datatwo
|
wparams.Payload = datatwo
|
||||||
woutmsg, err = whisper.NewSentMessage(wparams)
|
woutmsg, _ = whisper.NewSentMessage(wparams)
|
||||||
envtwo, err := woutmsg.Wrap(wparams)
|
envtwo, _ := woutmsg.Wrap(wparams)
|
||||||
msgtwo := &PssMsg{
|
msgtwo := &PssMsg{
|
||||||
Payload: envtwo,
|
Payload: envtwo,
|
||||||
To: to,
|
To: to,
|
||||||
}
|
}
|
||||||
wparams.Payload = datathree
|
wparams.Payload = datathree
|
||||||
woutmsg, err = whisper.NewSentMessage(wparams)
|
woutmsg, _ = whisper.NewSentMessage(wparams)
|
||||||
envthree, err := woutmsg.Wrap(wparams)
|
envthree, err := woutmsg.Wrap(wparams)
|
||||||
msgthree := &PssMsg{
|
msgthree := &PssMsg{
|
||||||
Payload: envthree,
|
Payload: envthree,
|
||||||
|
|
@ -1052,13 +1052,13 @@ func testSendRaw(t *testing.T) {
|
||||||
lmsgC := make(chan APIMsg)
|
lmsgC := make(chan APIMsg)
|
||||||
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer lcancel()
|
defer lcancel()
|
||||||
lsub, err := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, true, false)
|
lsub, _ := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, true, false)
|
||||||
log.Trace("lsub", "id", lsub)
|
log.Trace("lsub", "id", lsub)
|
||||||
defer lsub.Unsubscribe()
|
defer lsub.Unsubscribe()
|
||||||
rmsgC := make(chan APIMsg)
|
rmsgC := make(chan APIMsg)
|
||||||
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer rcancel()
|
defer rcancel()
|
||||||
rsub, err := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, true, false)
|
rsub, _ := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, true, false)
|
||||||
log.Trace("rsub", "id", rsub)
|
log.Trace("rsub", "id", rsub)
|
||||||
defer rsub.Unsubscribe()
|
defer rsub.Unsubscribe()
|
||||||
|
|
||||||
|
|
@ -1151,13 +1151,13 @@ func testSendSym(t *testing.T) {
|
||||||
lmsgC := make(chan APIMsg)
|
lmsgC := make(chan APIMsg)
|
||||||
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer lcancel()
|
defer lcancel()
|
||||||
lsub, err := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, false, false)
|
lsub, _ := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, false, false)
|
||||||
log.Trace("lsub", "id", lsub)
|
log.Trace("lsub", "id", lsub)
|
||||||
defer lsub.Unsubscribe()
|
defer lsub.Unsubscribe()
|
||||||
rmsgC := make(chan APIMsg)
|
rmsgC := make(chan APIMsg)
|
||||||
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer rcancel()
|
defer rcancel()
|
||||||
rsub, err := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
rsub, _ := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
||||||
log.Trace("rsub", "id", rsub)
|
log.Trace("rsub", "id", rsub)
|
||||||
defer rsub.Unsubscribe()
|
defer rsub.Unsubscribe()
|
||||||
|
|
||||||
|
|
@ -1266,13 +1266,13 @@ func testSendAsym(t *testing.T) {
|
||||||
lmsgC := make(chan APIMsg)
|
lmsgC := make(chan APIMsg)
|
||||||
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
lctx, lcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer lcancel()
|
defer lcancel()
|
||||||
lsub, err := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, false, false)
|
lsub, _ := clients[0].Subscribe(lctx, "pss", lmsgC, "receive", topic, false, false)
|
||||||
log.Trace("lsub", "id", lsub)
|
log.Trace("lsub", "id", lsub)
|
||||||
defer lsub.Unsubscribe()
|
defer lsub.Unsubscribe()
|
||||||
rmsgC := make(chan APIMsg)
|
rmsgC := make(chan APIMsg)
|
||||||
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
rctx, rcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer rcancel()
|
defer rcancel()
|
||||||
rsub, err := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
rsub, _ := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
||||||
log.Trace("rsub", "id", rsub)
|
log.Trace("rsub", "id", rsub)
|
||||||
defer rsub.Unsubscribe()
|
defer rsub.Unsubscribe()
|
||||||
|
|
||||||
|
|
@ -1603,7 +1603,7 @@ func TestDeduplication(t *testing.T) {
|
||||||
rmsgC := make(chan APIMsg)
|
rmsgC := make(chan APIMsg)
|
||||||
rctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
|
rctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
rsub, err := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
rsub, _ := clients[1].Subscribe(rctx, "pss", rmsgC, "receive", topic, false, false)
|
||||||
log.Trace("rsub", "id", rsub)
|
log.Trace("rsub", "id", rsub)
|
||||||
defer rsub.Unsubscribe()
|
defer rsub.Unsubscribe()
|
||||||
|
|
||||||
|
|
@ -1660,8 +1660,8 @@ func benchmarkSymKeySend(b *testing.B) {
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctx)
|
keys, _ := wapi.NewKeyPair(ctx)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, _ := w.GetPrivateKey(keys)
|
||||||
ps := newTestPss(privkey, nil, nil)
|
ps := newTestPss(privkey, nil, nil)
|
||||||
msg := make([]byte, msgsize)
|
msg := make([]byte, msgsize)
|
||||||
rand.Read(msg)
|
rand.Read(msg)
|
||||||
|
|
@ -1704,8 +1704,8 @@ func benchmarkAsymKeySend(b *testing.B) {
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctx)
|
keys, _ := wapi.NewKeyPair(ctx)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, _ := w.GetPrivateKey(keys)
|
||||||
ps := newTestPss(privkey, nil, nil)
|
ps := newTestPss(privkey, nil, nil)
|
||||||
msg := make([]byte, msgsize)
|
msg := make([]byte, msgsize)
|
||||||
rand.Read(msg)
|
rand.Read(msg)
|
||||||
|
|
@ -1750,8 +1750,8 @@ func benchmarkSymkeyBruteforceChangeaddr(b *testing.B) {
|
||||||
var keyid string
|
var keyid string
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctx)
|
keys, _ := wapi.NewKeyPair(ctx)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, _ := w.GetPrivateKey(keys)
|
||||||
if cachesize > 0 {
|
if cachesize > 0 {
|
||||||
ps = newTestPss(privkey, nil, &PssParams{SymKeyCacheCapacity: int(cachesize)})
|
ps = newTestPss(privkey, nil, &PssParams{SymKeyCacheCapacity: int(cachesize)})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1833,8 +1833,8 @@ func benchmarkSymkeyBruteforceSameaddr(b *testing.B) {
|
||||||
addr := make([]PssAddress, keycount)
|
addr := make([]PssAddress, keycount)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctx)
|
keys, _ := wapi.NewKeyPair(ctx)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, _ := w.GetPrivateKey(keys)
|
||||||
if cachesize > 0 {
|
if cachesize > 0 {
|
||||||
ps = newTestPss(privkey, nil, &PssParams{SymKeyCacheCapacity: int(cachesize)})
|
ps = newTestPss(privkey, nil, &PssParams{SymKeyCacheCapacity: int(cachesize)})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1953,8 +1953,8 @@ func newServices(allowRaw bool) adapters.Services {
|
||||||
|
|
||||||
ctxlocal, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctxlocal, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
keys, err := wapi.NewKeyPair(ctxlocal)
|
keys, _ := wapi.NewKeyPair(ctxlocal)
|
||||||
privkey, err := w.GetPrivateKey(keys)
|
privkey, _ := w.GetPrivateKey(keys)
|
||||||
pssp := NewPssParams().WithPrivateKey(privkey)
|
pssp := NewPssParams().WithPrivateKey(privkey)
|
||||||
pssp.AllowRaw = allowRaw
|
pssp.AllowRaw = allowRaw
|
||||||
pskad := kademlia(ctx.Config.ID)
|
pskad := kademlia(ctx.Config.ID)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue