aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/shhapi
diff options
context:
space:
mode:
Diffstat (limited to 'whisper/shhapi')
-rw-r--r--whisper/shhapi/api.go16
-rw-r--r--whisper/shhapi/api_test.go9
2 files changed, 25 insertions, 0 deletions
diff --git a/whisper/shhapi/api.go b/whisper/shhapi/api.go
index 6ed3e17c2..f2597e133 100644
--- a/whisper/shhapi/api.go
+++ b/whisper/shhapi/api.go
@@ -55,6 +55,22 @@ func APIs() []rpc.API {
}
}
+// Start starts the Whisper worker threads.
+func (api *PublicWhisperAPI) Start() error {
+ if api.whisper == nil {
+ return whisperOffLineErr
+ }
+ return api.whisper.Start(nil)
+}
+
+// Stop stops the Whisper worker threads.
+func (api *PublicWhisperAPI) Stop() error {
+ if api.whisper == nil {
+ return whisperOffLineErr
+ }
+ return api.whisper.Stop()
+}
+
// Version returns the Whisper version this node offers.
func (api *PublicWhisperAPI) Version() (*rpc.HexNumber, error) {
if api.whisper == nil {
diff --git a/whisper/shhapi/api_test.go b/whisper/shhapi/api_test.go
index 13a7cee66..a10e2e476 100644
--- a/whisper/shhapi/api_test.go
+++ b/whisper/shhapi/api_test.go
@@ -277,6 +277,9 @@ func TestIntegrationAsym(t *testing.T) {
t.Fatalf("failed to create API.")
}
+ api.Start()
+ defer api.Stop()
+
sig, err := api.NewIdentity()
if err != nil {
t.Fatalf("failed NewIdentity: %s.", err)
@@ -375,6 +378,9 @@ func TestIntegrationSym(t *testing.T) {
t.Fatalf("failed to create API.")
}
+ api.Start()
+ defer api.Stop()
+
keyname := "schluessel"
err := api.GenerateSymKey(keyname)
if err != nil {
@@ -471,6 +477,9 @@ func TestIntegrationSymWithFilter(t *testing.T) {
t.Fatalf("failed to create API.")
}
+ api.Start()
+ defer api.Stop()
+
keyname := "schluessel"
err := api.GenerateSymKey(keyname)
if err != nil {