Set unlimited size of ETH RPC message
This commit is contained in:
parent
2751a9b03f
commit
35ab7a3966
@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/golang/glog"
|
||||
"github.com/juju/errors"
|
||||
"github.com/trezor/blockbook/bchain"
|
||||
@ -46,15 +44,7 @@ func NewBNBSmartChainRPC(config json.RawMessage, pushHandler func(bchain.Notific
|
||||
|
||||
// Initialize bnb smart chain rpc interface
|
||||
func (b *BNBSmartChainRPC) Initialize() error {
|
||||
b.OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) {
|
||||
r, err := rpc.Dial(url)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
rc := ð.EthereumRPCClient{Client: r}
|
||||
ec := ð.EthereumClient{Client: ethclient.NewClient(r)}
|
||||
return rc, ec, nil
|
||||
}
|
||||
b.OpenRPC = eth.OpenRPC
|
||||
|
||||
rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL)
|
||||
if err != nil {
|
||||
|
||||
@ -107,17 +107,22 @@ func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.Notification
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// OpenRPC opens RPC connection to ETH backend
|
||||
var OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) {
|
||||
opts := []rpc.ClientOption{}
|
||||
opts = append(opts, rpc.WithWebsocketMessageSizeLimit(0))
|
||||
r, err := rpc.DialOptions(context.Background(), url, opts...)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
rc := &EthereumRPCClient{Client: r}
|
||||
ec := &EthereumClient{Client: ethclient.NewClient(r)}
|
||||
return rc, ec, nil
|
||||
}
|
||||
|
||||
// Initialize initializes ethereum rpc interface
|
||||
func (b *EthereumRPC) Initialize() error {
|
||||
b.OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) {
|
||||
r, err := rpc.Dial(url)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
rc := &EthereumRPCClient{Client: r}
|
||||
ec := &EthereumClient{Client: ethclient.NewClient(r)}
|
||||
return rc, ec, nil
|
||||
}
|
||||
b.OpenRPC = OpenRPC
|
||||
|
||||
rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL)
|
||||
if err != nil {
|
||||
|
||||
@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/golang/glog"
|
||||
"github.com/juju/errors"
|
||||
"github.com/trezor/blockbook/bchain"
|
||||
@ -38,15 +36,7 @@ func NewPolygonRPC(config json.RawMessage, pushHandler func(bchain.NotificationT
|
||||
|
||||
// Initialize polygon rpc interface
|
||||
func (b *PolygonRPC) Initialize() error {
|
||||
b.OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) {
|
||||
r, err := rpc.Dial(url)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
rc := ð.EthereumRPCClient{Client: r}
|
||||
ec := ð.EthereumClient{Client: ethclient.NewClient(r)}
|
||||
return rc, ec, nil
|
||||
}
|
||||
b.OpenRPC = eth.OpenRPC
|
||||
|
||||
rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL)
|
||||
if err != nil {
|
||||
|
||||
@ -38,5 +38,4 @@ prepare-sources:
|
||||
mkdir -p $(BLOCKBOOK_BASE)
|
||||
cp -r /src $(BLOCKBOOK_SRC)
|
||||
cd $(BLOCKBOOK_SRC) && go mod download
|
||||
sed -i 's/wsMessageSizeLimit\ =\ 15\ \*\ 1024\ \*\ 1024/wsMessageSizeLimit = 80 * 1024 * 1024/g' $(GOPATH)/pkg/mod/github.com/ethereum/go-ethereum*/rpc/websocket.go
|
||||
sed -i 's/wsMessageSizeLimit\ =\ 15\ \*\ 1024\ \*\ 1024/wsMessageSizeLimit = 80 * 1024 * 1024/g' $(GOPATH)/pkg/mod/github.com/ava-labs/coreth*/rpc/websocket.go
|
||||
|
||||
Loading…
Reference in New Issue
Block a user