mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 07:23:46 +00:00
whisper: wnode bugfix
This commit is contained in:
parent
a96ba2af42
commit
6bad91a259
1 changed files with 5 additions and 5 deletions
|
|
@ -65,7 +65,7 @@ var (
|
||||||
pub *ecdsa.PublicKey
|
pub *ecdsa.PublicKey
|
||||||
asymKey *ecdsa.PrivateKey
|
asymKey *ecdsa.PrivateKey
|
||||||
nodeid *ecdsa.PrivateKey
|
nodeid *ecdsa.PrivateKey
|
||||||
topic []byte
|
topic whisper.TopicType
|
||||||
asymKeyID string
|
asymKeyID string
|
||||||
filterID string
|
filterID string
|
||||||
symPass string
|
symPass string
|
||||||
|
|
@ -129,7 +129,7 @@ func processArgs() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("Failed to parse the topic: %s", err)
|
utils.Fatalf("Failed to parse the topic: %s", err)
|
||||||
}
|
}
|
||||||
topic = x
|
topic = whisper.BytesToTopic(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *asymmetricMode && len(*argPub) > 0 {
|
if *asymmetricMode && len(*argPub) > 0 {
|
||||||
|
|
@ -355,7 +355,7 @@ func configureNode() {
|
||||||
filter := whisper.Filter{
|
filter := whisper.Filter{
|
||||||
KeySym: symKey,
|
KeySym: symKey,
|
||||||
KeyAsym: asymKey,
|
KeyAsym: asymKey,
|
||||||
Topics: [][]byte{topic},
|
Topics: [][]byte{topic[:]},
|
||||||
AllowP2P: p2pAccept,
|
AllowP2P: p2pAccept,
|
||||||
}
|
}
|
||||||
filterID, err = shh.Subscribe(&filter)
|
filterID, err = shh.Subscribe(&filter)
|
||||||
|
|
@ -366,7 +366,7 @@ func configureNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateTopic(password []byte) {
|
func generateTopic(password []byte) {
|
||||||
x := pbkdf2.Key(password, password, 8196, 128, sha512.New)
|
x := pbkdf2.Key(password, password, 4096, 128, sha512.New)
|
||||||
for i := 0; i < len(x); i++ {
|
for i := 0; i < len(x); i++ {
|
||||||
topic[i%whisper.TopicLength] ^= x[i]
|
topic[i%whisper.TopicLength] ^= x[i]
|
||||||
}
|
}
|
||||||
|
|
@ -486,7 +486,7 @@ func sendMsg(payload []byte) common.Hash {
|
||||||
Dst: pub,
|
Dst: pub,
|
||||||
KeySym: symKey,
|
KeySym: symKey,
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Topic: whisper.BytesToTopic(topic),
|
Topic: topic,
|
||||||
TTL: uint32(*argTTL),
|
TTL: uint32(*argTTL),
|
||||||
PoW: *argPoW,
|
PoW: *argPoW,
|
||||||
WorkTime: uint32(*argWorkTime),
|
WorkTime: uint32(*argWorkTime),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue