From 40e66e6186164a422e432fd754b8f86b958014f3 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Thu, 26 Sep 2019 11:26:33 +0200 Subject: [PATCH] upgrade status-protocol-go (#1619) --- go.mod | 2 +- go.sum | 4 ++-- .../status-im/status-protocol-go/messenger.go | 17 +++++++---------- vendor/modules.txt | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 8bb0c6e42..ebfa2b740 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/status-im/doubleratchet v2.0.0+incompatible github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed github.com/status-im/rendezvous v1.3.0 - github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 + github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44 github.com/status-im/whisper v1.4.14 github.com/stretchr/testify v1.3.1-0.20190712000136-221dbe5ed467 github.com/syndtr/goleveldb v1.0.0 diff --git a/go.sum b/go.sum index b981c709b..933cbd6ec 100644 --- a/go.sum +++ b/go.sum @@ -456,8 +456,8 @@ github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf0 github.com/status-im/migrate/v4 v4.0.0-20190821140204-a9d340ec8fb76af4afda06acf01740d45d2661ed/go.mod h1:r8HggRBZ/k7TRwByq/Hp3P/ubFppIna0nvyavVK0pjA= github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4= github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s= -github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 h1:TKNkXEZfWKlOISfEWAxooQe1nmRHELXLhvp/ep1b6lI= -github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607/go.mod h1:g059a1CeUmHKzsokiKwdk5pCuhCPE1GeOh8vULbfn5w= +github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44 h1:RzyVhzGT79zfFFW7RpGnfk/Nvg+WjgTamGdw4o2InYk= +github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44/go.mod h1:g059a1CeUmHKzsokiKwdk5pCuhCPE1GeOh8vULbfn5w= github.com/status-im/whisper v1.4.14 h1:9VHqx4+PUYfhDnYYtDxHkg/3cfVvkHjPNciY4LO83yc= github.com/status-im/whisper v1.4.14/go.mod h1:WS6z39YJQ8WJa9s+DmTuEM/s2nVF6Iz3B1SZYw5cYf0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/status-im/status-protocol-go/messenger.go b/vendor/github.com/status-im/status-protocol-go/messenger.go index 07d58349a..29862945b 100644 --- a/vendor/github.com/status-im/status-protocol-go/messenger.go +++ b/vendor/github.com/status-im/status-protocol-go/messenger.go @@ -235,25 +235,22 @@ func NewMessenger( } } - var err error - // Configure the database. database := c.db - if database == nil && c.dbConfig != (dbConfig{}) { + if c.db == nil && c.dbConfig == (dbConfig{}) { + return nil, errors.New("database instance or database path needs to be provided") + } + if c.db == nil { logger.Info("opening a database", zap.String("dbPath", c.dbConfig.dbPath)) + var err error database, err = sqlite.Open(c.dbConfig.dbPath, c.dbConfig.dbKey) if err != nil { return nil, errors.Wrap(err, "failed to initialize database from the db config") } - } else { - logger.Info("using in-memory database") - database, err = sqlite.Open(":memory:", "") - if err != nil { - return nil, errors.Wrap(err, "failed to initialize in-memory database") - } } + // Apply migrations for all components. - err = sqlite.Migrate(database) + err := sqlite.Migrate(database) if err != nil { return nil, errors.Wrap(err, "failed to apply migrations") } diff --git a/vendor/modules.txt b/vendor/modules.txt index 4397ae634..3b91458e2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -319,7 +319,7 @@ github.com/status-im/migrate/v4/source/go_bindata github.com/status-im/rendezvous github.com/status-im/rendezvous/protocol github.com/status-im/rendezvous/server -# github.com/status-im/status-protocol-go v0.0.0-20190926044311-1e2e007bc607 +# github.com/status-im/status-protocol-go v0.0.0-20190926081215-cc44ddb7ce44 github.com/status-im/status-protocol-go github.com/status-im/status-protocol-go/applicationmetadata github.com/status-im/status-protocol-go/crypto