Update mailserver canary to be compatible with geth 1.8.17 upgrade
This commit is contained in:
parent
92748f1334
commit
d3c8079075
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/crypto/sha3"
|
"github.com/ethereum/go-ethereum/crypto/sha3"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
"github.com/ethereum/go-ethereum/p2p/discv5"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/status-im/status-go/api"
|
"github.com/status-im/status-go/api"
|
||||||
"github.com/status-im/status-go/logutils"
|
"github.com/status-im/status-go/logutils"
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
|
@ -50,9 +50,9 @@ var (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
var err error
|
||||||
var staticParsedNode, mailserverParsedNode *discv5.Node
|
var staticParsedNode, mailserverParsedNode *enode.Node
|
||||||
if *staticEnodeAddr != "" {
|
if *staticEnodeAddr != "" {
|
||||||
staticParsedNode, err = discv5.ParseNode(*staticEnodeAddr)
|
staticParsedNode, err = enode.ParseV4(*staticEnodeAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Crit("Invalid static address specified", "staticEnodeAddr", *staticEnodeAddr, "error", err)
|
logger.Crit("Invalid static address specified", "staticEnodeAddr", *staticEnodeAddr, "error", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -60,7 +60,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *mailserverEnodeAddr != "" {
|
if *mailserverEnodeAddr != "" {
|
||||||
mailserverParsedNode, err = discv5.ParseNode(*mailserverEnodeAddr)
|
mailserverParsedNode, err = enode.ParseV4(*mailserverEnodeAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Crit("Invalid mailserver address specified", "mailserverEnodeAddr", *mailserverEnodeAddr, "error", err)
|
logger.Crit("Invalid mailserver address specified", "mailserverEnodeAddr", *mailserverEnodeAddr, "error", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -96,7 +96,7 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyMailserverBehavior(mailserverNode *discv5.Node) {
|
func verifyMailserverBehavior(mailserverNode *enode.Node) {
|
||||||
clientBackend, err := startClientNode()
|
clientBackend, err := startClientNode()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Node start failed", "error", err)
|
logger.Error("Node start failed", "error", err)
|
||||||
|
@ -138,11 +138,10 @@ func verifyMailserverBehavior(mailserverNode *discv5.Node) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
mailboxPeer := mailserverNode.ID[:]
|
mailboxPeer := mailserverNode.ID().Bytes()
|
||||||
mailboxPeerStr := mailserverNode.ID.String()
|
|
||||||
err = clientWhisperService.AllowP2PMessagesFromPeer(mailboxPeer)
|
err = clientWhisperService.AllowP2PMessagesFromPeer(mailboxPeer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Failed to allow P2P messages from peer", "error", err)
|
logger.Error("Failed to allow P2P messages from mailserver peer", "error", err, mailserverNode.String())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +168,7 @@ func verifyMailserverBehavior(mailserverNode *discv5.Node) {
|
||||||
shhextAPI := shhext.NewPublicAPI(clientShhExtService)
|
shhextAPI := shhext.NewPublicAPI(clientShhExtService)
|
||||||
requestIDBytes, err := shhextAPI.RequestMessages(context.TODO(),
|
requestIDBytes, err := shhextAPI.RequestMessages(context.TODO(),
|
||||||
shhext.MessagesRequest{
|
shhext.MessagesRequest{
|
||||||
MailServerPeer: mailboxPeerStr,
|
MailServerPeer: mailserverNode.String(),
|
||||||
From: uint32(clientWhisperService.GetCurrentTime().Add(-time.Duration(*period) * time.Second).Unix()),
|
From: uint32(clientWhisperService.GetCurrentTime().Add(-time.Duration(*period) * time.Second).Unix()),
|
||||||
Limit: 1,
|
Limit: 1,
|
||||||
Topic: topic,
|
Topic: topic,
|
||||||
|
@ -197,7 +196,7 @@ func verifyMailserverBehavior(mailserverNode *discv5.Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyStaticNodeBehavior(staticNode *discv5.Node) {
|
func verifyStaticNodeBehavior(staticNode *enode.Node) {
|
||||||
clientBackend, err := startClientNode()
|
clientBackend, err := startClientNode()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Node start failed", "error", err)
|
logger.Error("Node start failed", "error", err)
|
||||||
|
|
Loading…
Reference in New Issue