mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 22:26:30 +00:00
9d01f7aa26
An issue arose that shh_newMessageFilter was routed to the upstream instead of local node. This PR fixes that. It also revisits routing logic and makes all requests go to the local node by default.
36 lines
749 B
Go
36 lines
749 B
Go
package rpc
|
|
|
|
import (
|
|
"github.com/stretchr/testify/require"
|
|
"testing"
|
|
)
|
|
|
|
// some of the upstream examples
|
|
var localMethods = []string{"some_weirdo_method", "shh_newMessageFilter", "net_version"}
|
|
|
|
func TestRouteWithUpstream(t *testing.T) {
|
|
router := newRouter(true)
|
|
|
|
for _, method := range remoteMethods {
|
|
require.True(t, router.routeRemote(method))
|
|
}
|
|
|
|
for _, method := range localMethods {
|
|
t.Run(method, func(t *testing.T) {
|
|
require.False(t, router.routeRemote(method))
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestRouteWithoutUpstream(t *testing.T) {
|
|
router := newRouter(false)
|
|
|
|
for _, method := range remoteMethods {
|
|
require.True(t, router.routeRemote(method))
|
|
}
|
|
|
|
for _, method := range localMethods {
|
|
require.True(t, router.routeRemote(method))
|
|
}
|
|
}
|