feat_: Allow to set light client

This commit is contained in:
Andrea Maria Piana 2023-11-27 11:08:17 +00:00
parent e1f61515ef
commit f48f9cccc6
4 changed files with 24 additions and 0 deletions

View File

@ -786,3 +786,8 @@ func GetNodeConfigFromDB(db *sql.DB) (*params.NodeConfig, error) {
return loadNodeConfig(tx)
}
func SetLightClient(db *sql.DB, enabled bool) error {
_, err := db.Exec(`UPDATE wakuv2_config SET light_client = ?`, enabled)
return err
}

View File

@ -0,0 +1,10 @@
package protocol
import (
"github.com/status-im/status-go/nodecfg"
"github.com/status-im/status-go/protocol/requests"
)
func (m *Messenger) SetLightClient(request *requests.SetLightClient) error {
return nodecfg.SetLightClient(m.database, request.Enabled)
}

View File

@ -0,0 +1,5 @@
package requests
type SetLightClient struct {
Enabled bool `json:"enabled"`
}

View File

@ -1685,6 +1685,10 @@ func (api *PublicAPI) SyncChat(request *requests.SyncChat) error {
return api.service.messenger.SyncChat(request)
}
func (api *PublicAPI) SetLightClient(request *requests.SetLightClient) error {
return api.service.messenger.SetLightClient(request)
}
// -----
// HELPER
// -----