2021-06-30 11:40:54 +00:00
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
2024-05-15 23:15:22 +00:00
|
|
|
"crypto/ecdsa"
|
2023-12-12 07:37:57 +00:00
|
|
|
"database/sql"
|
2021-07-09 13:19:33 +00:00
|
|
|
"encoding/json"
|
2021-06-30 11:40:54 +00:00
|
|
|
"errors"
|
|
|
|
"fmt"
|
2024-05-15 23:15:22 +00:00
|
|
|
"os"
|
2021-07-09 13:19:33 +00:00
|
|
|
"reflect"
|
2023-04-26 15:37:18 +00:00
|
|
|
"time"
|
2021-06-30 11:40:54 +00:00
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
|
2023-11-15 15:58:15 +00:00
|
|
|
"github.com/status-im/status-go/protocol/common/shard"
|
2022-06-25 07:20:02 +00:00
|
|
|
"github.com/status-im/status-go/server"
|
2023-07-05 15:56:34 +00:00
|
|
|
"github.com/status-im/status-go/signal"
|
2023-08-01 18:50:30 +00:00
|
|
|
"github.com/status-im/status-go/transactions"
|
2022-06-25 07:20:02 +00:00
|
|
|
|
2024-05-15 23:15:22 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/ethereum/go-ethereum/event"
|
|
|
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
2021-07-09 13:19:33 +00:00
|
|
|
gethrpc "github.com/ethereum/go-ethereum/rpc"
|
2021-06-30 11:40:54 +00:00
|
|
|
|
|
|
|
"github.com/status-im/status-go/appmetrics"
|
|
|
|
"github.com/status-im/status-go/common"
|
|
|
|
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
2024-05-15 23:15:22 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/crypto"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
"github.com/status-im/status-go/logutils"
|
|
|
|
"github.com/status-im/status-go/mailserver"
|
|
|
|
"github.com/status-im/status-go/multiaccounts/accounts"
|
2023-10-09 19:31:47 +00:00
|
|
|
"github.com/status-im/status-go/multiaccounts/settings"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/params"
|
|
|
|
"github.com/status-im/status-go/rpc"
|
|
|
|
accountssvc "github.com/status-im/status-go/services/accounts"
|
2023-10-09 19:31:47 +00:00
|
|
|
"github.com/status-im/status-go/services/accounts/settingsevent"
|
2024-08-29 10:33:24 +00:00
|
|
|
appgeneral "github.com/status-im/status-go/services/app-general"
|
2021-06-30 11:40:54 +00:00
|
|
|
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
|
|
|
"github.com/status-im/status-go/services/browsers"
|
2022-02-10 15:15:27 +00:00
|
|
|
"github.com/status-im/status-go/services/chat"
|
2023-08-25 15:36:39 +00:00
|
|
|
"github.com/status-im/status-go/services/communitytokens"
|
2024-06-24 14:29:40 +00:00
|
|
|
"github.com/status-im/status-go/services/connector"
|
2021-12-21 15:05:09 +00:00
|
|
|
"github.com/status-im/status-go/services/ens"
|
2024-10-04 12:55:28 +00:00
|
|
|
"github.com/status-im/status-go/services/eth"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/services/ext"
|
2022-01-31 12:58:03 +00:00
|
|
|
"github.com/status-im/status-go/services/gif"
|
2021-06-30 11:40:54 +00:00
|
|
|
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
|
|
|
"github.com/status-im/status-go/services/mailservers"
|
|
|
|
"github.com/status-im/status-go/services/peer"
|
|
|
|
"github.com/status-im/status-go/services/permissions"
|
|
|
|
"github.com/status-im/status-go/services/personal"
|
|
|
|
"github.com/status-im/status-go/services/rpcfilters"
|
|
|
|
"github.com/status-im/status-go/services/rpcstats"
|
2021-08-05 13:27:47 +00:00
|
|
|
"github.com/status-im/status-go/services/status"
|
2022-02-02 22:50:55 +00:00
|
|
|
"github.com/status-im/status-go/services/stickers"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/services/subscriptions"
|
2022-06-08 12:38:26 +00:00
|
|
|
"github.com/status-im/status-go/services/updates"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/services/wakuext"
|
|
|
|
"github.com/status-im/status-go/services/wakuv2ext"
|
|
|
|
"github.com/status-im/status-go/services/wallet"
|
2023-07-12 18:27:36 +00:00
|
|
|
"github.com/status-im/status-go/services/wallet/thirdparty"
|
2023-08-11 11:28:45 +00:00
|
|
|
"github.com/status-im/status-go/services/wallet/transfer"
|
2021-12-21 15:44:37 +00:00
|
|
|
"github.com/status-im/status-go/services/web3provider"
|
2021-06-30 11:40:54 +00:00
|
|
|
"github.com/status-im/status-go/timesource"
|
|
|
|
"github.com/status-im/status-go/waku"
|
|
|
|
wakucommon "github.com/status-im/status-go/waku/common"
|
|
|
|
"github.com/status-im/status-go/wakuv2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrWakuClearIdentitiesFailure clearing whisper identities has failed.
|
|
|
|
ErrWakuClearIdentitiesFailure = errors.New("failed to clear waku identities")
|
2021-07-09 13:19:33 +00:00
|
|
|
// ErrRPCClientUnavailable is returned if an RPC client can't be retrieved.
|
|
|
|
// This is a normal situation when a node is stopped.
|
|
|
|
ErrRPCClientUnavailable = errors.New("JSON-RPC client is unavailable")
|
2021-06-30 11:40:54 +00:00
|
|
|
)
|
|
|
|
|
2022-06-25 07:20:02 +00:00
|
|
|
func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server.MediaServer) error {
|
2023-10-09 19:31:47 +00:00
|
|
|
settingsFeed := &event.Feed{}
|
2022-03-23 18:47:00 +00:00
|
|
|
accDB, err := accounts.NewDB(b.appDB)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2023-12-12 07:37:57 +00:00
|
|
|
|
2023-10-09 19:31:47 +00:00
|
|
|
setSettingsNotifier(accDB, settingsFeed)
|
2021-06-30 11:40:54 +00:00
|
|
|
|
|
|
|
services := []common.StatusService{}
|
2024-10-11 17:01:14 +00:00
|
|
|
services = append(services, b.rpcFiltersService())
|
2021-06-30 11:40:54 +00:00
|
|
|
services = append(services, b.subscriptionService())
|
|
|
|
services = append(services, b.rpcStatsService())
|
|
|
|
services = append(services, b.appmetricsService())
|
2024-08-29 10:33:24 +00:00
|
|
|
services = append(services, b.appgeneralService())
|
2021-06-30 11:40:54 +00:00
|
|
|
services = append(services, b.peerService())
|
|
|
|
services = append(services, b.personalService())
|
2021-08-05 13:27:47 +00:00
|
|
|
services = append(services, b.statusPublicService())
|
2023-08-01 18:50:30 +00:00
|
|
|
services = append(services, b.pendingTrackerService(&b.walletFeed))
|
2023-04-26 15:37:18 +00:00
|
|
|
services = append(services, b.ensService(b.timeSourceNow()))
|
2023-08-25 15:36:39 +00:00
|
|
|
services = append(services, b.CommunityTokensService())
|
2022-03-23 18:47:00 +00:00
|
|
|
services = append(services, b.stickersService(accDB))
|
2022-06-08 12:38:26 +00:00
|
|
|
services = append(services, b.updatesService())
|
2024-08-30 19:28:03 +00:00
|
|
|
services = appendIf(b.appDB != nil && b.multiaccountsDB != nil, services, b.accountsService(&b.accountsFeed, accDB, mediaServer))
|
2021-06-30 11:40:54 +00:00
|
|
|
services = appendIf(config.BrowsersConfig.Enabled, services, b.browsersService())
|
|
|
|
services = appendIf(config.PermissionsConfig.Enabled, services, b.permissionsService())
|
|
|
|
services = appendIf(config.MailserversConfig.Enabled, services, b.mailserversService())
|
2022-03-23 18:47:00 +00:00
|
|
|
services = appendIf(config.Web3ProviderConfig.Enabled, services, b.providerService(accDB))
|
2024-06-24 14:29:40 +00:00
|
|
|
services = appendIf(config.ConnectorConfig.Enabled, services, b.connectorService())
|
2022-03-23 18:47:00 +00:00
|
|
|
services = append(services, b.gifService(accDB))
|
|
|
|
services = append(services, b.ChatService(accDB))
|
2021-12-21 15:44:37 +00:00
|
|
|
|
2023-07-12 18:27:36 +00:00
|
|
|
// Wallet Service is used by wakuExtSrvc/wakuV2ExtSrvc
|
|
|
|
// Keep this initialization before the other two
|
|
|
|
if config.WalletConfig.Enabled {
|
2024-08-30 19:28:03 +00:00
|
|
|
walletService := b.walletService(accDB, b.appDB, &b.accountsFeed, settingsFeed, &b.walletFeed, config.WalletConfig.StatusProxyStageName)
|
2023-07-12 18:27:36 +00:00
|
|
|
services = append(services, walletService)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CollectiblesManager needs the WakuExt service to get metadata for
|
|
|
|
// Community collectibles.
|
|
|
|
// Messenger needs the CollectiblesManager to get the list of collectibles owned
|
|
|
|
// by a certain account and check community entry permissions.
|
2023-10-26 06:30:18 +00:00
|
|
|
// We handle circular dependency between the two by delaying ininitalization of the CommunityCollectibleInfoProvider
|
2023-07-12 18:27:36 +00:00
|
|
|
// in the CollectiblesManager.
|
2021-06-30 11:40:54 +00:00
|
|
|
if config.WakuConfig.Enabled {
|
|
|
|
wakuService, err := b.wakuService(&config.WakuConfig, &config.ClusterConfig)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
services = append(services, wakuService)
|
|
|
|
|
|
|
|
wakuext, err := b.wakuExtService(config)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
b.wakuExtSrvc = wakuext
|
|
|
|
|
|
|
|
services = append(services, wakuext)
|
2023-07-12 18:27:36 +00:00
|
|
|
|
2023-12-14 16:50:46 +00:00
|
|
|
b.SetWalletCommunityInfoProvider(wakuext)
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if config.WakuV2Config.Enabled {
|
2023-02-23 20:30:13 +00:00
|
|
|
telemetryServerURL := ""
|
|
|
|
if accDB.DB() != nil {
|
|
|
|
telemetryServerURL, err = accDB.GetTelemetryServerURL()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-05-22 22:01:54 +00:00
|
|
|
if telemetryServerURL != "" {
|
|
|
|
config.WakuV2Config.TelemetryServerURL = telemetryServerURL
|
|
|
|
}
|
2023-01-31 22:46:47 +00:00
|
|
|
}
|
2024-05-22 22:01:54 +00:00
|
|
|
waku2Service, err := b.wakuV2Service(config)
|
2021-06-30 11:40:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
services = append(services, waku2Service)
|
|
|
|
|
|
|
|
wakuext, err := b.wakuV2ExtService(config)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
b.wakuV2ExtSrvc = wakuext
|
|
|
|
|
|
|
|
services = append(services, wakuext)
|
|
|
|
|
2023-12-14 16:50:46 +00:00
|
|
|
b.SetWalletCommunityInfoProvider(wakuext)
|
2023-06-28 10:48:33 +00:00
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
// We ignore for now local notifications flag as users who are upgrading have no mean to enable it
|
2022-03-23 18:47:00 +00:00
|
|
|
lns, err := b.localNotificationsService(config.NetworkID)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
services = append(services, lns)
|
2021-06-30 11:40:54 +00:00
|
|
|
|
2024-10-04 12:55:28 +00:00
|
|
|
services = append(services, b.ethService())
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
b.peerSrvc.SetDiscoverer(b)
|
|
|
|
|
|
|
|
for i := range services {
|
2021-07-09 13:19:33 +00:00
|
|
|
b.RegisterLifecycle(services[i])
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
2021-07-09 13:19:33 +00:00
|
|
|
b.services = services
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-07-09 13:19:33 +00:00
|
|
|
func (b *StatusNode) RegisterLifecycle(s common.StatusService) {
|
|
|
|
b.addPublicMethods(s.APIs())
|
|
|
|
b.gethNode.RegisterAPIs(s.APIs())
|
|
|
|
b.gethNode.RegisterProtocols(s.Protocols())
|
|
|
|
b.gethNode.RegisterLifecycle(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add through reflection a list of public methods so we can check when the
|
|
|
|
// user makes a call if they are allowed
|
|
|
|
func (b *StatusNode) addPublicMethods(apis []gethrpc.API) {
|
|
|
|
for _, api := range apis {
|
|
|
|
if api.Public {
|
|
|
|
addSuitableCallbacks(reflect.ValueOf(api.Service), api.Namespace, b.publicMethods)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) nodeBridge() types.Node {
|
|
|
|
return gethbridge.NewNodeBridge(b.gethNode, b.wakuSrvc, b.wakuV2Srvc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) wakuExtService(config *params.NodeConfig) (*wakuext.Service, error) {
|
|
|
|
if b.gethNode == nil {
|
|
|
|
return nil, errors.New("geth node not initialized")
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.wakuExtSrvc == nil {
|
2022-06-02 12:17:52 +00:00
|
|
|
b.wakuExtSrvc = wakuext.New(*config, b.nodeBridge(), b.rpcClient, ext.EnvelopeSignalHandler{}, b.db)
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
b.wakuExtSrvc.SetP2PServer(b.gethNode.Server())
|
|
|
|
return b.wakuExtSrvc, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) wakuV2ExtService(config *params.NodeConfig) (*wakuv2ext.Service, error) {
|
|
|
|
if b.gethNode == nil {
|
|
|
|
return nil, errors.New("geth node not initialized")
|
|
|
|
}
|
|
|
|
if b.wakuV2ExtSrvc == nil {
|
2022-06-02 12:17:52 +00:00
|
|
|
b.wakuV2ExtSrvc = wakuv2ext.New(*config, b.nodeBridge(), b.rpcClient, ext.EnvelopeSignalHandler{}, b.db)
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
b.wakuV2ExtSrvc.SetP2PServer(b.gethNode.Server())
|
|
|
|
return b.wakuV2ExtSrvc, nil
|
|
|
|
}
|
|
|
|
|
2021-08-05 13:27:47 +00:00
|
|
|
func (b *StatusNode) statusPublicService() *status.Service {
|
|
|
|
if b.statusPublicSrvc == nil {
|
|
|
|
b.statusPublicSrvc = status.New()
|
|
|
|
}
|
|
|
|
return b.statusPublicSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) StatusPublicService() *status.Service {
|
|
|
|
return b.statusPublicSrvc
|
|
|
|
}
|
|
|
|
|
2022-07-06 16:12:49 +00:00
|
|
|
func (b *StatusNode) AccountService() *accountssvc.Service {
|
|
|
|
return b.accountsSrvc
|
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
func (b *StatusNode) BrowserService() *browsers.Service {
|
|
|
|
return b.browsersSrvc
|
|
|
|
}
|
|
|
|
|
2023-04-26 15:37:18 +00:00
|
|
|
func (b *StatusNode) EnsService() *ens.Service {
|
|
|
|
return b.ensSrvc
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) WakuService() *waku.Waku {
|
|
|
|
return b.wakuSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) WakuExtService() *wakuext.Service {
|
|
|
|
return b.wakuExtSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) WakuV2ExtService() *wakuv2ext.Service {
|
|
|
|
return b.wakuV2ExtSrvc
|
|
|
|
}
|
|
|
|
func (b *StatusNode) WakuV2Service() *wakuv2.Waku {
|
|
|
|
return b.wakuV2Srvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) (*waku.Waku, error) {
|
|
|
|
if b.wakuSrvc == nil {
|
|
|
|
cfg := &waku.Config{
|
|
|
|
MaxMessageSize: wakucommon.DefaultMaxMessageSize,
|
|
|
|
BloomFilterMode: wakuCfg.BloomFilterMode,
|
|
|
|
FullNode: wakuCfg.FullNode,
|
|
|
|
SoftBlacklistedPeerIDs: wakuCfg.SoftBlacklistedPeerIDs,
|
|
|
|
MinimumAcceptedPoW: params.WakuMinimumPoW,
|
|
|
|
EnableConfirmations: wakuCfg.EnableConfirmations,
|
|
|
|
}
|
|
|
|
|
|
|
|
if wakuCfg.MaxMessageSize > 0 {
|
|
|
|
cfg.MaxMessageSize = wakuCfg.MaxMessageSize
|
|
|
|
}
|
|
|
|
if wakuCfg.MinimumPoW > 0 {
|
|
|
|
cfg.MinimumAcceptedPoW = wakuCfg.MinimumPoW
|
|
|
|
}
|
|
|
|
|
|
|
|
w := waku.New(cfg, logutils.ZapLogger())
|
|
|
|
|
|
|
|
if wakuCfg.EnableRateLimiter {
|
|
|
|
r := wakuRateLimiter(wakuCfg, clusterCfg)
|
|
|
|
w.RegisterRateLimiter(r)
|
|
|
|
}
|
|
|
|
|
|
|
|
if timesource := b.timeSource(); timesource != nil {
|
|
|
|
w.SetTimeSource(timesource.Now)
|
|
|
|
}
|
|
|
|
|
|
|
|
// enable mail service
|
|
|
|
if wakuCfg.EnableMailServer {
|
|
|
|
if err := registerWakuMailServer(w, wakuCfg); err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to register WakuMailServer: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if wakuCfg.LightClient {
|
|
|
|
emptyBloomFilter := make([]byte, 64)
|
|
|
|
if err := w.SetBloomFilter(emptyBloomFilter); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b.wakuSrvc = w
|
|
|
|
}
|
|
|
|
return b.wakuSrvc, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-05-22 22:01:54 +00:00
|
|
|
func (b *StatusNode) wakuV2Service(nodeConfig *params.NodeConfig) (*wakuv2.Waku, error) {
|
2021-06-30 11:40:54 +00:00
|
|
|
if b.wakuV2Srvc == nil {
|
|
|
|
cfg := &wakuv2.Config{
|
2024-07-10 10:39:37 +00:00
|
|
|
MaxMessageSize: wakucommon.DefaultMaxMessageSize,
|
|
|
|
Host: nodeConfig.WakuV2Config.Host,
|
|
|
|
Port: nodeConfig.WakuV2Config.Port,
|
|
|
|
LightClient: nodeConfig.WakuV2Config.LightClient,
|
|
|
|
WakuNodes: nodeConfig.ClusterConfig.WakuNodes,
|
|
|
|
EnableStore: nodeConfig.WakuV2Config.EnableStore,
|
|
|
|
StoreCapacity: nodeConfig.WakuV2Config.StoreCapacity,
|
|
|
|
StoreSeconds: nodeConfig.WakuV2Config.StoreSeconds,
|
|
|
|
DiscoveryLimit: nodeConfig.WakuV2Config.DiscoveryLimit,
|
|
|
|
DiscV5BootstrapNodes: nodeConfig.ClusterConfig.DiscV5BootstrapNodes,
|
|
|
|
Nameserver: nodeConfig.WakuV2Config.Nameserver,
|
|
|
|
UDPPort: nodeConfig.WakuV2Config.UDPPort,
|
|
|
|
AutoUpdate: nodeConfig.WakuV2Config.AutoUpdate,
|
|
|
|
DefaultShardPubsubTopic: shard.DefaultShardPubsubTopic(),
|
|
|
|
TelemetryServerURL: nodeConfig.WakuV2Config.TelemetryServerURL,
|
|
|
|
ClusterID: nodeConfig.ClusterConfig.ClusterID,
|
|
|
|
EnableMissingMessageVerification: nodeConfig.WakuV2Config.EnableMissingMessageVerification,
|
|
|
|
EnableStoreConfirmationForMessagesSent: nodeConfig.WakuV2Config.EnableStoreConfirmationForMessagesSent,
|
2024-08-01 18:36:25 +00:00
|
|
|
UseThrottledPublish: true,
|
2024-02-27 09:24:34 +00:00
|
|
|
}
|
|
|
|
|
2024-03-01 05:43:07 +00:00
|
|
|
// Configure peer exchange and discv5 settings based on node type
|
2024-02-27 09:24:34 +00:00
|
|
|
if cfg.LightClient {
|
|
|
|
cfg.EnablePeerExchangeServer = false
|
|
|
|
cfg.EnablePeerExchangeClient = true
|
2024-03-01 05:43:07 +00:00
|
|
|
cfg.EnableDiscV5 = false
|
2024-02-27 09:24:34 +00:00
|
|
|
} else {
|
|
|
|
cfg.EnablePeerExchangeServer = true
|
|
|
|
cfg.EnablePeerExchangeClient = false
|
2024-03-01 05:43:07 +00:00
|
|
|
cfg.EnableDiscV5 = true
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
2021-10-06 16:08:54 +00:00
|
|
|
if nodeConfig.WakuV2Config.MaxMessageSize > 0 {
|
|
|
|
cfg.MaxMessageSize = nodeConfig.WakuV2Config.MaxMessageSize
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
2024-05-15 23:15:22 +00:00
|
|
|
var nodeKey *ecdsa.PrivateKey
|
|
|
|
var err error
|
|
|
|
if nodeConfig.NodeKey != "" {
|
|
|
|
nodeKey, err = crypto.HexToECDSA(nodeConfig.NodeKey)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not convert nodekey into a valid private key: %v", err)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nodeKeyStr := os.Getenv("WAKUV2_NODE_KEY")
|
|
|
|
if nodeKeyStr != "" {
|
|
|
|
nodeKeyBytes, err := hexutil.Decode(nodeKeyStr)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to decode the go-waku private key: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
nodeKey, err = crypto.ToECDSA(nodeKeyBytes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not convert nodekey into a valid private key: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
w, err := wakuv2.New(nodeKey, nodeConfig.ClusterConfig.Fleet, cfg, logutils.ZapLogger(), b.appDB, b.timeSource(), signal.SendHistoricMessagesRequestFailed, signal.SendPeerStats)
|
2021-06-30 11:40:54 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b.wakuV2Srvc = w
|
|
|
|
}
|
|
|
|
|
|
|
|
return b.wakuV2Srvc, nil
|
|
|
|
}
|
|
|
|
|
2023-10-09 19:31:47 +00:00
|
|
|
func setSettingsNotifier(db *accounts.Database, feed *event.Feed) {
|
|
|
|
db.SetSettingsNotifier(func(setting settings.SettingField, val interface{}) {
|
|
|
|
feed.Send(settingsevent.Event{
|
|
|
|
Type: settingsevent.EventTypeChanged,
|
|
|
|
Setting: setting,
|
|
|
|
Value: val,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func wakuRateLimiter(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) *wakucommon.PeerRateLimiter {
|
|
|
|
enodes := append(
|
|
|
|
parseNodes(clusterCfg.StaticNodes),
|
|
|
|
parseNodes(clusterCfg.TrustedMailServers)...,
|
|
|
|
)
|
|
|
|
var (
|
|
|
|
ips []string
|
|
|
|
peerIDs []enode.ID
|
|
|
|
)
|
|
|
|
for _, item := range enodes {
|
|
|
|
ips = append(ips, item.IP().String())
|
|
|
|
peerIDs = append(peerIDs, item.ID())
|
|
|
|
}
|
|
|
|
return wakucommon.NewPeerRateLimiter(
|
|
|
|
&wakucommon.PeerRateLimiterConfig{
|
|
|
|
PacketLimitPerSecIP: wakuCfg.PacketRateLimitIP,
|
|
|
|
PacketLimitPerSecPeerID: wakuCfg.PacketRateLimitPeerID,
|
|
|
|
BytesLimitPerSecIP: wakuCfg.BytesRateLimitIP,
|
|
|
|
BytesLimitPerSecPeerID: wakuCfg.BytesRateLimitPeerID,
|
|
|
|
WhitelistedIPs: ips,
|
|
|
|
WhitelistedPeerIDs: peerIDs,
|
|
|
|
},
|
|
|
|
&wakucommon.MetricsRateLimiterHandler{},
|
|
|
|
&wakucommon.DropPeerRateLimiterHandler{
|
|
|
|
Tolerance: wakuCfg.RateLimitTolerance,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-24 14:29:40 +00:00
|
|
|
func (b *StatusNode) connectorService() *connector.Service {
|
|
|
|
if b.connectorSrvc == nil {
|
2024-07-18 15:30:10 +00:00
|
|
|
b.connectorSrvc = connector.NewService(b.walletDB, b.rpcClient, b.rpcClient.NetworkManager)
|
2024-06-24 14:29:40 +00:00
|
|
|
}
|
|
|
|
return b.connectorSrvc
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) rpcFiltersService() *rpcfilters.Service {
|
|
|
|
if b.rpcFiltersSrvc == nil {
|
|
|
|
b.rpcFiltersSrvc = rpcfilters.New(b)
|
|
|
|
}
|
|
|
|
return b.rpcFiltersSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) subscriptionService() *subscriptions.Service {
|
|
|
|
if b.subscriptionsSrvc == nil {
|
|
|
|
|
2021-07-09 13:19:33 +00:00
|
|
|
b.subscriptionsSrvc = subscriptions.New(func() *rpc.Client { return b.RPCClient() })
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
return b.subscriptionsSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) rpcStatsService() *rpcstats.Service {
|
|
|
|
if b.rpcStatsSrvc == nil {
|
|
|
|
b.rpcStatsSrvc = rpcstats.New()
|
|
|
|
}
|
|
|
|
|
|
|
|
return b.rpcStatsSrvc
|
|
|
|
}
|
|
|
|
|
2022-06-25 07:20:02 +00:00
|
|
|
func (b *StatusNode) accountsService(accountsFeed *event.Feed, accDB *accounts.Database, mediaServer *server.MediaServer) *accountssvc.Service {
|
2021-06-30 11:40:54 +00:00
|
|
|
if b.accountsSrvc == nil {
|
2022-01-24 09:29:18 +00:00
|
|
|
b.accountsSrvc = accountssvc.NewService(
|
2022-03-23 18:47:00 +00:00
|
|
|
accDB,
|
2022-01-24 09:29:18 +00:00
|
|
|
b.multiaccountsDB,
|
|
|
|
b.gethAccountManager,
|
|
|
|
b.config,
|
|
|
|
accountsFeed,
|
2022-06-25 07:20:02 +00:00
|
|
|
mediaServer,
|
2022-01-24 09:29:18 +00:00
|
|
|
)
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return b.accountsSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) browsersService() *browsers.Service {
|
|
|
|
if b.browsersSrvc == nil {
|
|
|
|
b.browsersSrvc = browsers.NewService(browsers.NewDB(b.appDB))
|
|
|
|
}
|
|
|
|
return b.browsersSrvc
|
|
|
|
}
|
|
|
|
|
2023-04-26 15:37:18 +00:00
|
|
|
func (b *StatusNode) ensService(timesource func() time.Time) *ens.Service {
|
2021-12-21 15:05:09 +00:00
|
|
|
if b.ensSrvc == nil {
|
2023-08-01 18:50:30 +00:00
|
|
|
b.ensSrvc = ens.NewService(b.rpcClient, b.gethAccountManager, b.pendingTracker, b.config, b.appDB, timesource)
|
2021-12-21 15:05:09 +00:00
|
|
|
}
|
|
|
|
return b.ensSrvc
|
|
|
|
}
|
|
|
|
|
2023-08-01 18:50:30 +00:00
|
|
|
func (b *StatusNode) pendingTrackerService(walletFeed *event.Feed) *transactions.PendingTxTracker {
|
|
|
|
if b.pendingTracker == nil {
|
2023-08-30 16:14:57 +00:00
|
|
|
b.pendingTracker = transactions.NewPendingTxTracker(b.walletDB, b.rpcClient, b.rpcFiltersSrvc, walletFeed, transactions.PendingCheckInterval)
|
2024-03-12 09:15:30 +00:00
|
|
|
if b.transactor != nil {
|
|
|
|
b.transactor.SetPendingTracker(b.pendingTracker)
|
|
|
|
}
|
2023-08-01 18:50:30 +00:00
|
|
|
}
|
|
|
|
return b.pendingTracker
|
|
|
|
}
|
|
|
|
|
2023-08-25 15:36:39 +00:00
|
|
|
func (b *StatusNode) CommunityTokensService() *communitytokens.Service {
|
|
|
|
if b.communityTokensSrvc == nil {
|
2024-04-05 14:00:32 +00:00
|
|
|
b.communityTokensSrvc = communitytokens.NewService(b.rpcClient, b.gethAccountManager, b.pendingTracker, b.config, b.appDB, &b.walletFeed, b.transactor)
|
2023-01-12 15:17:21 +00:00
|
|
|
}
|
2023-08-25 15:36:39 +00:00
|
|
|
return b.communityTokensSrvc
|
2023-01-12 15:17:21 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 18:47:00 +00:00
|
|
|
func (b *StatusNode) stickersService(accountDB *accounts.Database) *stickers.Service {
|
2022-02-02 22:50:55 +00:00
|
|
|
if b.stickersSrvc == nil {
|
2023-08-01 18:50:30 +00:00
|
|
|
b.stickersSrvc = stickers.NewService(accountDB, b.rpcClient, b.gethAccountManager, b.config, b.downloader, b.httpServer, b.pendingTracker)
|
2022-02-02 22:50:55 +00:00
|
|
|
}
|
|
|
|
return b.stickersSrvc
|
|
|
|
}
|
|
|
|
|
2022-06-08 12:38:26 +00:00
|
|
|
func (b *StatusNode) updatesService() *updates.Service {
|
|
|
|
if b.updatesSrvc == nil {
|
2023-04-26 15:37:18 +00:00
|
|
|
b.updatesSrvc = updates.NewService(b.ensService(b.timeSourceNow()))
|
2022-06-08 12:38:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return b.updatesSrvc
|
|
|
|
}
|
|
|
|
|
2022-03-23 18:47:00 +00:00
|
|
|
func (b *StatusNode) gifService(accountsDB *accounts.Database) *gif.Service {
|
2022-01-31 12:58:03 +00:00
|
|
|
if b.gifSrvc == nil {
|
2022-03-23 18:47:00 +00:00
|
|
|
b.gifSrvc = gif.NewService(accountsDB)
|
2022-01-31 12:58:03 +00:00
|
|
|
}
|
|
|
|
return b.gifSrvc
|
|
|
|
}
|
|
|
|
|
2022-03-23 18:47:00 +00:00
|
|
|
func (b *StatusNode) ChatService(accountsDB *accounts.Database) *chat.Service {
|
2022-02-10 15:15:27 +00:00
|
|
|
if b.chatSrvc == nil {
|
2022-03-23 18:47:00 +00:00
|
|
|
b.chatSrvc = chat.NewService(accountsDB)
|
2022-02-10 15:15:27 +00:00
|
|
|
}
|
|
|
|
return b.chatSrvc
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) permissionsService() *permissions.Service {
|
|
|
|
if b.permissionsSrvc == nil {
|
|
|
|
b.permissionsSrvc = permissions.NewService(permissions.NewDB(b.appDB))
|
|
|
|
}
|
|
|
|
return b.permissionsSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) mailserversService() *mailservers.Service {
|
|
|
|
if b.mailserversSrvc == nil {
|
|
|
|
|
|
|
|
b.mailserversSrvc = mailservers.NewService(mailservers.NewDB(b.appDB))
|
|
|
|
}
|
|
|
|
return b.mailserversSrvc
|
|
|
|
}
|
2021-12-21 15:44:37 +00:00
|
|
|
|
2022-03-23 18:47:00 +00:00
|
|
|
func (b *StatusNode) providerService(accountsDB *accounts.Database) *web3provider.Service {
|
|
|
|
web3S := web3provider.NewService(b.appDB, accountsDB, b.rpcClient, b.config, b.gethAccountManager, b.rpcFiltersSrvc, b.transactor)
|
2021-12-21 15:44:37 +00:00
|
|
|
if b.providerSrvc == nil {
|
2022-03-23 18:47:00 +00:00
|
|
|
b.providerSrvc = web3S
|
2021-12-21 15:44:37 +00:00
|
|
|
}
|
|
|
|
return b.providerSrvc
|
|
|
|
}
|
2021-06-30 11:40:54 +00:00
|
|
|
|
|
|
|
func (b *StatusNode) appmetricsService() common.StatusService {
|
|
|
|
if b.appMetricsSrvc == nil {
|
|
|
|
b.appMetricsSrvc = appmetricsservice.NewService(appmetrics.NewDB(b.appDB))
|
|
|
|
}
|
|
|
|
return b.appMetricsSrvc
|
|
|
|
}
|
|
|
|
|
2024-08-29 10:33:24 +00:00
|
|
|
func (b *StatusNode) appgeneralService() *appgeneral.Service {
|
|
|
|
if b.appGeneralSrvc == nil {
|
|
|
|
b.appGeneralSrvc = appgeneral.New()
|
|
|
|
}
|
|
|
|
return b.appGeneralSrvc
|
|
|
|
}
|
|
|
|
|
2023-04-25 12:00:17 +00:00
|
|
|
func (b *StatusNode) WalletService() *wallet.Service {
|
|
|
|
return b.walletSrvc
|
|
|
|
}
|
|
|
|
|
2024-08-30 19:28:03 +00:00
|
|
|
func (b *StatusNode) AccountsFeed() *event.Feed {
|
|
|
|
return &b.accountsFeed
|
|
|
|
}
|
|
|
|
|
2023-12-14 16:50:46 +00:00
|
|
|
func (b *StatusNode) SetWalletCommunityInfoProvider(provider thirdparty.CommunityInfoProvider) {
|
2023-09-21 12:40:58 +00:00
|
|
|
if b.walletSrvc != nil {
|
2023-12-14 16:50:46 +00:00
|
|
|
b.walletSrvc.SetWalletCommunityInfoProvider(provider)
|
2023-09-21 12:40:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-14 15:35:48 +00:00
|
|
|
func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB, accountsFeed *event.Feed, settingsFeed *event.Feed, walletFeed *event.Feed, statusProxyStageName string) *wallet.Service {
|
2021-06-30 11:40:54 +00:00
|
|
|
if b.walletSrvc == nil {
|
2022-09-13 07:10:59 +00:00
|
|
|
b.walletSrvc = wallet.NewService(
|
2023-12-12 07:37:57 +00:00
|
|
|
b.walletDB, accountsDB, appDB, b.rpcClient, accountsFeed, settingsFeed, b.gethAccountManager, b.transactor, b.config,
|
2023-04-26 15:37:18 +00:00
|
|
|
b.ensService(b.timeSourceNow()),
|
2022-09-13 07:10:59 +00:00
|
|
|
b.stickersService(accountsDB),
|
2023-08-01 18:50:30 +00:00
|
|
|
b.pendingTracker,
|
|
|
|
walletFeed,
|
2023-12-15 20:29:39 +00:00
|
|
|
b.httpServer,
|
2024-08-14 15:35:48 +00:00
|
|
|
statusProxyStageName,
|
2022-09-13 07:10:59 +00:00
|
|
|
)
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
return b.walletSrvc
|
|
|
|
}
|
|
|
|
|
2022-03-23 18:47:00 +00:00
|
|
|
func (b *StatusNode) localNotificationsService(network uint64) (*localnotifications.Service, error) {
|
|
|
|
var err error
|
2021-06-30 11:40:54 +00:00
|
|
|
if b.localNotificationsSrvc == nil {
|
2023-08-11 11:28:45 +00:00
|
|
|
b.localNotificationsSrvc, err = localnotifications.NewService(b.appDB, transfer.NewDB(b.walletDB), network)
|
2022-03-23 18:47:00 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
2022-03-23 18:47:00 +00:00
|
|
|
return b.localNotificationsSrvc, nil
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) peerService() *peer.Service {
|
|
|
|
if b.peerSrvc == nil {
|
|
|
|
b.peerSrvc = peer.New()
|
|
|
|
}
|
|
|
|
return b.peerSrvc
|
|
|
|
}
|
|
|
|
|
2024-10-04 12:55:28 +00:00
|
|
|
func (b *StatusNode) ethService() *eth.Service {
|
|
|
|
if b.ethSrvc == nil {
|
|
|
|
b.ethSrvc = eth.NewService(b.rpcClient)
|
|
|
|
}
|
|
|
|
return b.ethSrvc
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func registerWakuMailServer(wakuService *waku.Waku, config *params.WakuConfig) (err error) {
|
|
|
|
var mailServer mailserver.WakuMailServer
|
|
|
|
wakuService.RegisterMailServer(&mailServer)
|
|
|
|
|
|
|
|
return mailServer.Init(wakuService, config)
|
|
|
|
}
|
|
|
|
|
|
|
|
func appendIf(condition bool, services []common.StatusService, service common.StatusService) []common.StatusService {
|
|
|
|
if !condition {
|
|
|
|
return services
|
|
|
|
}
|
|
|
|
return append(services, service)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) RPCFiltersService() *rpcfilters.Service {
|
|
|
|
return b.rpcFiltersSrvc
|
|
|
|
}
|
|
|
|
|
2023-08-01 18:50:30 +00:00
|
|
|
func (b *StatusNode) PendingTracker() *transactions.PendingTxTracker {
|
|
|
|
return b.pendingTracker
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) StopLocalNotifications() error {
|
|
|
|
if b.localNotificationsSrvc == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.localNotificationsSrvc.IsStarted() {
|
|
|
|
err := b.localNotificationsSrvc.Stop()
|
|
|
|
if err != nil {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
b.logger.Error("LocalNotifications service stop failed on StopLocalNotifications", zap.Error(err))
|
2021-06-30 11:40:54 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) StartLocalNotifications() error {
|
|
|
|
if b.localNotificationsSrvc == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.walletSrvc == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if !b.localNotificationsSrvc.IsStarted() {
|
|
|
|
err := b.localNotificationsSrvc.Start()
|
|
|
|
|
|
|
|
if err != nil {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
b.logger.Error("LocalNotifications service start failed on StartLocalNotifications", zap.Error(err))
|
2021-06-30 11:40:54 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-01 18:50:30 +00:00
|
|
|
err := b.localNotificationsSrvc.SubscribeWallet(&b.walletFeed)
|
2021-06-30 11:40:54 +00:00
|
|
|
|
|
|
|
if err != nil {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
b.logger.Error("LocalNotifications service could not subscribe to wallet on StartLocalNotifications", zap.Error(err))
|
2021-06-30 11:40:54 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// `personal_sign` and `personal_ecRecover` methods are important to
|
|
|
|
// keep DApps working.
|
|
|
|
// Usually, they are provided by an ETH or a LES service, but when using
|
|
|
|
// upstream, we don't start any of these, so we need to start our own
|
|
|
|
// implementation.
|
|
|
|
|
|
|
|
func (b *StatusNode) personalService() *personal.Service {
|
|
|
|
if b.personalSrvc == nil {
|
|
|
|
b.personalSrvc = personal.New(b.accountsManager)
|
|
|
|
}
|
|
|
|
return b.personalSrvc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) timeSource() *timesource.NTPTimeSource {
|
|
|
|
|
|
|
|
if b.timeSourceSrvc == nil {
|
|
|
|
b.timeSourceSrvc = timesource.Default()
|
|
|
|
}
|
|
|
|
return b.timeSourceSrvc
|
|
|
|
}
|
|
|
|
|
2023-04-26 15:37:18 +00:00
|
|
|
func (b *StatusNode) timeSourceNow() func() time.Time {
|
|
|
|
return b.timeSource().Now
|
|
|
|
}
|
|
|
|
|
2021-06-30 11:40:54 +00:00
|
|
|
func (b *StatusNode) Cleanup() error {
|
|
|
|
if b.wakuSrvc != nil {
|
|
|
|
if err := b.wakuSrvc.DeleteKeyPairs(); err != nil {
|
|
|
|
return fmt.Errorf("%s: %v", ErrWakuClearIdentitiesFailure, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-12 09:44:26 +00:00
|
|
|
if b.Config() != nil && b.Config().WalletConfig.Enabled {
|
2021-06-30 11:40:54 +00:00
|
|
|
if b.walletSrvc != nil {
|
|
|
|
if b.walletSrvc.IsStarted() {
|
|
|
|
err := b.walletSrvc.Stop()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-10 11:41:04 +00:00
|
|
|
if b.ensSrvc != nil {
|
|
|
|
err := b.ensSrvc.Stop()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-08-23 12:29:30 +00:00
|
|
|
}
|
|
|
|
|
2024-08-12 21:30:13 +00:00
|
|
|
if b.pendingTracker != nil {
|
|
|
|
err := b.pendingTracker.Stop()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-09 13:07:57 +00:00
|
|
|
return nil
|
2021-06-30 11:40:54 +00:00
|
|
|
}
|
2021-07-09 13:19:33 +00:00
|
|
|
|
|
|
|
type RPCCall struct {
|
|
|
|
Method string `json:"method"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *StatusNode) CallPrivateRPC(inputJSON string) (string, error) {
|
|
|
|
b.mu.Lock()
|
|
|
|
defer b.mu.Unlock()
|
|
|
|
if b.rpcClient == nil {
|
|
|
|
return "", ErrRPCClientUnavailable
|
|
|
|
}
|
|
|
|
|
|
|
|
return b.rpcClient.CallRaw(inputJSON), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// CallRPC calls public methods on the node, we register public methods
|
|
|
|
// in a map and check if they can be called in this function
|
|
|
|
func (b *StatusNode) CallRPC(inputJSON string) (string, error) {
|
|
|
|
b.mu.Lock()
|
|
|
|
defer b.mu.Unlock()
|
|
|
|
if b.rpcClient == nil {
|
|
|
|
return "", ErrRPCClientUnavailable
|
|
|
|
}
|
|
|
|
|
|
|
|
rpcCall := &RPCCall{}
|
|
|
|
err := json.Unmarshal([]byte(inputJSON), rpcCall)
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
|
|
|
|
if rpcCall.Method == "" || !b.publicMethods[rpcCall.Method] {
|
|
|
|
return ErrRPCMethodUnavailable, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return b.rpcClient.CallRaw(inputJSON), nil
|
|
|
|
}
|