From 45ffd5599de2c293c97cb1e734c1f0c6ed9248a5 Mon Sep 17 00:00:00 2001 From: Victor Farazdagi Date: Tue, 26 Jul 2016 05:58:52 +0300 Subject: [PATCH] Minor updates to make bindings work on updated ethereum branch --- src/gethdep_test.go | 16 +++++++++------- src/main.go | 18 +++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/gethdep_test.go b/src/gethdep_test.go index 435aaa6e7..57eca8cd4 100644 --- a/src/gethdep_test.go +++ b/src/gethdep_test.go @@ -37,11 +37,14 @@ func TestAccountBindings(t *testing.T) { } time.Sleep(2 * time.Second) - // test to see if the account was injected in whisper - whisperInstance := (*accountSync)[0].(*whisper.Whisper) - identitySucess := whisperInstance.HasIdentity(crypto.ToECDSAPub(common.FromHex(pubkey))) - if !identitySucess || err != nil { - t.Error("Test failed: identity not injected into whisper") + // test to see if the account was injected in whisqer + var whisperInstance *whisper.Whisper + if err := currentNode.Service(&whisperInstance); err != nil { + t.Errorf("whisper service not running: %v", err) + } + identitySucsess := whisperInstance.HasIdentity(crypto.ToECDSAPub(common.FromHex(pubkey))) + if !identitySucsess || err != nil { + t.Errorf("Test failed: identity not injected into whisper: %v", err) } // test to see if we can post with the injected whisper identity @@ -55,7 +58,7 @@ func TestAccountBindings(t *testing.T) { whisperAPI := whisper.NewPublicWhisperAPI(whisperInstance) postSucess, err := whisperAPI.Post(postArgs) if !postSucess || err != nil { - t.Error("Test failed: Could not post to whisper") + t.Errorf("Test failed: Could not post to whisper: %v", err) } // clean up @@ -63,5 +66,4 @@ func TestAccountBindings(t *testing.T) { if err != nil { t.Error("Test failed: could not clean up temporary datadir") } - } diff --git a/src/main.go b/src/main.go index 944d31d11..7a6a8bfd5 100644 --- a/src/main.go +++ b/src/main.go @@ -5,9 +5,9 @@ import ( "fmt" "runtime" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/node" @@ -29,14 +29,14 @@ const ( ) var ( - vString string // Combined textual representation of the version - rConfig release.Config // Structured version information and release oracle config - currentNode *node.Node // currently running geth node - c *cli.Context // the CLI context used to start the geth node - accountSync *[]node.Service // the object used to sync accounts between geth services - accountManager *accounts.Manager // the account manager attached to the currentNode - whisperService *whisper.Whisper // whisper service - datadir string // data directory for geth + vString string // Combined textual representation of the version + rConfig release.Config // Structured version information and release oracle config + currentNode *node.Node // currently running geth node + c *cli.Context // the CLI context used to start the geth node + accountSync *[]node.Service // the object used to sync accounts between geth services + accountManager *accounts.Manager // the account manager attached to the currentNode + whisperService *whisper.Whisper // whisper service + datadir string // data directory for geth ) func main() {