mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
parent
b36c72a8ef
commit
1c7a46ec41
7 changed files with 8 additions and 9 deletions
|
|
@ -29,8 +29,7 @@
|
||||||
var web3 = require('web3');
|
var web3 = require('web3');
|
||||||
var eth = web3.eth;
|
var eth = web3.eth;
|
||||||
|
|
||||||
web3.setProvider(new
|
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||||
web3.providers.HttpSyncProvider('http://localhost:8545'));
|
|
||||||
var desc = [{
|
var desc = [{
|
||||||
"name": "balance(address)",
|
"name": "balance(address)",
|
||||||
"inputs": [{
|
"inputs": [{
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ if ls $dir/*.go &> /dev/null; then
|
||||||
# echo $dir
|
# echo $dir
|
||||||
if [[ $dir != "./tests/vm" ]]
|
if [[ $dir != "./tests/vm" ]]
|
||||||
then
|
then
|
||||||
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
|
$GOROOT/bin/go test -covermode=count -coverprofile=$dir/profile.tmp $dir
|
||||||
fi
|
fi
|
||||||
if [ -f $dir/profile.tmp ]
|
if [ -f $dir/profile.tmp ]
|
||||||
then
|
then
|
||||||
|
|
@ -25,7 +25,7 @@ if ls $dir/*.go &> /dev/null; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
go tool cover -func profile.cov
|
$GOROOT/bin/go tool cover -func profile.cov
|
||||||
|
|
||||||
# To submit the test coverage result to coveralls.io,
|
# To submit the test coverage result to coveralls.io,
|
||||||
# use goveralls (https://github.com/mattn/goveralls)
|
# use goveralls (https://github.com/mattn/goveralls)
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ func (self *Whisper) Messages(id int) (messages *ethutil.List) {
|
||||||
|
|
||||||
func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
|
func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
|
||||||
if to, ok := opts["to"].(string); ok {
|
if to, ok := opts["to"].(string); ok {
|
||||||
f.To = crypto.ToECDSAPub(fromHex(to))
|
f.To = crypto.ToECDSA(fromHex(to))
|
||||||
}
|
}
|
||||||
if from, ok := opts["from"].(string); ok {
|
if from, ok := opts["from"].(string); ok {
|
||||||
f.From = crypto.ToECDSAPub(fromHex(from))
|
f.From = crypto.ToECDSAPub(fromHex(from))
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package whisper
|
||||||
import "crypto/ecdsa"
|
import "crypto/ecdsa"
|
||||||
|
|
||||||
type Filter struct {
|
type Filter struct {
|
||||||
To *ecdsa.PublicKey
|
To *ecdsa.PrivateKey
|
||||||
From *ecdsa.PublicKey
|
From *ecdsa.PublicKey
|
||||||
Topics [][]byte
|
Topics [][]byte
|
||||||
Fn func(*Message)
|
Fn func(*Message)
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ func (self *Whisper) GetIdentity(key *ecdsa.PublicKey) *ecdsa.PrivateKey {
|
||||||
|
|
||||||
func (self *Whisper) Watch(opts Filter) int {
|
func (self *Whisper) Watch(opts Filter) int {
|
||||||
return self.filters.Install(filter.Generic{
|
return self.filters.Install(filter.Generic{
|
||||||
Str1: string(crypto.FromECDSAPub(opts.To)),
|
Str1: string(crypto.FromECDSA(opts.To)),
|
||||||
Str2: string(crypto.FromECDSAPub(opts.From)),
|
Str2: string(crypto.FromECDSAPub(opts.From)),
|
||||||
Data: bytesToMap(opts.Topics),
|
Data: bytesToMap(opts.Topics),
|
||||||
Fn: func(data interface{}) {
|
Fn: func(data interface{}) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ func TestEvent(t *testing.T) {
|
||||||
whisper := New()
|
whisper := New()
|
||||||
id := whisper.NewIdentity()
|
id := whisper.NewIdentity()
|
||||||
whisper.Watch(Filter{
|
whisper.Watch(Filter{
|
||||||
To: &id.PublicKey,
|
To: id,
|
||||||
Fn: func(msg *Message) {
|
Fn: func(msg *Message) {
|
||||||
res <- msg
|
res <- msg
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func (self *Whisper) HasIdentity(key string) bool {
|
||||||
|
|
||||||
func (self *Whisper) Watch(opts *Options) int {
|
func (self *Whisper) Watch(opts *Options) int {
|
||||||
filter := whisper.Filter{
|
filter := whisper.Filter{
|
||||||
To: crypto.ToECDSAPub(fromHex(opts.To)),
|
To: crypto.ToECDSA(fromHex(opts.To)),
|
||||||
From: crypto.ToECDSAPub(fromHex(opts.From)),
|
From: crypto.ToECDSAPub(fromHex(opts.From)),
|
||||||
Topics: whisper.TopicsFromString(opts.Topics...),
|
Topics: whisper.TopicsFromString(opts.Topics...),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue