Minor updates to make bindings work on updated ethereum branch

This commit is contained in:
Victor Farazdagi 2016-07-26 05:58:52 +03:00
parent a26a3ad649
commit 45ffd5599d
2 changed files with 18 additions and 16 deletions

View File

@ -37,11 +37,14 @@ func TestAccountBindings(t *testing.T) {
} }
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
// test to see if the account was injected in whisper // test to see if the account was injected in whisqer
whisperInstance := (*accountSync)[0].(*whisper.Whisper) var whisperInstance *whisper.Whisper
identitySucess := whisperInstance.HasIdentity(crypto.ToECDSAPub(common.FromHex(pubkey))) if err := currentNode.Service(&whisperInstance); err != nil {
if !identitySucess || err != nil { t.Errorf("whisper service not running: %v", err)
t.Error("Test failed: identity not injected into whisper") }
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 // 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) whisperAPI := whisper.NewPublicWhisperAPI(whisperInstance)
postSucess, err := whisperAPI.Post(postArgs) postSucess, err := whisperAPI.Post(postArgs)
if !postSucess || err != nil { 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 // clean up
@ -63,5 +66,4 @@ func TestAccountBindings(t *testing.T) {
if err != nil { if err != nil {
t.Error("Test failed: could not clean up temporary datadir") t.Error("Test failed: could not clean up temporary datadir")
} }
} }

View File

@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
@ -29,14 +29,14 @@ const (
) )
var ( var (
vString string // Combined textual representation of the version vString string // Combined textual representation of the version
rConfig release.Config // Structured version information and release oracle config rConfig release.Config // Structured version information and release oracle config
currentNode *node.Node // currently running geth node currentNode *node.Node // currently running geth node
c *cli.Context // the CLI context used to start the 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 accountSync *[]node.Service // the object used to sync accounts between geth services
accountManager *accounts.Manager // the account manager attached to the currentNode accountManager *accounts.Manager // the account manager attached to the currentNode
whisperService *whisper.Whisper // whisper service whisperService *whisper.Whisper // whisper service
datadir string // data directory for geth datadir string // data directory for geth
) )
func main() { func main() {