diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-15 09:29:52 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-15 09:29:52 +0800 |
commit | c924a841c7a6661b3a609c16c447231f5ae951c8 (patch) | |
tree | 77b94bb5393e86d663813bef9b2699532d3a1972 | |
parent | 12fc590b34fba3391799fbdfd66ef029f7a551f4 (diff) | |
parent | 7299eb72e0c57d8bf7279cbf2544c266a3fd145b (diff) | |
download | dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar.gz dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar.bz2 dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar.lz dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar.xz dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.tar.zst dexon-c924a841c7a6661b3a609c16c447231f5ae951c8.zip |
Merge branch 'develop' into bounty
-rw-r--r-- | core/chain_manager.go | 2 | ||||
-rw-r--r-- | crypto/secp256k1/secp256.go | 7 | ||||
-rw-r--r-- | p2p/server.go | 8 | ||||
-rw-r--r-- | rpc/args.go | 6 | ||||
-rw-r--r-- | rpc/http/server.go | 2 | ||||
-rw-r--r-- | rpc/packages.go | 8 |
6 files changed, 19 insertions, 14 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 308e958fe..54f1ced8c 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -168,7 +168,7 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { var root []byte parentHash := ZeroHash256 - if bc.CurrentBlock != nil { + if bc.currentBlock != nil { root = bc.currentBlock.Header().Root parentHash = bc.lastBlockHash } diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go index c1e37629e..4864e8d09 100644 --- a/crypto/secp256k1/secp256.go +++ b/crypto/secp256k1/secp256.go @@ -15,8 +15,9 @@ import "C" import ( "bytes" "errors" - "github.com/ethereum/go-ethereum/crypto/randentropy" "unsafe" + + "github.com/ethereum/go-ethereum/crypto/randentropy" ) //#define USE_FIELD_5X64 @@ -85,6 +86,10 @@ func GenerateKeyPair() ([]byte, []byte) { } func GeneratePubKey(seckey []byte) ([]byte, error) { + if err := VerifySeckeyValidity(seckey); err != nil { + return nil, err + } + pubkey_len := C.int(65) const seckey_len = 32 diff --git a/p2p/server.go b/p2p/server.go index e510be521..35b584a27 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -436,15 +436,15 @@ func (self *BlacklistMap) Exists(pubkey []byte) (ok bool) { } func (self *BlacklistMap) Put(pubkey []byte) error { - self.lock.RLock() - defer self.lock.RUnlock() + self.lock.Lock() + defer self.lock.Unlock() self.blacklist[string(pubkey)] = true return nil } func (self *BlacklistMap) Delete(pubkey []byte) error { - self.lock.RLock() - defer self.lock.RUnlock() + self.lock.Lock() + defer self.lock.Unlock() delete(self.blacklist, string(pubkey)) return nil } diff --git a/rpc/args.go b/rpc/args.go index 84b076d4a..12e3103bc 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -43,7 +43,7 @@ type PushTxArgs struct { func (obj *PushTxArgs) UnmarshalJSON(b []byte) (err error) { arg0 := "" - if err = json.Unmarshal(b, arg0); err == nil { + if err = json.Unmarshal(b, &arg0); err == nil { obj.Tx = arg0 return } @@ -82,7 +82,7 @@ type GetStateArgs struct { func (obj *GetStateArgs) UnmarshalJSON(b []byte) (err error) { arg0 := "" - if err = json.Unmarshal(b, arg0); err == nil { + if err = json.Unmarshal(b, &arg0); err == nil { obj.Address = arg0 return } @@ -114,7 +114,7 @@ type GetTxCountArgs struct { func (obj *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) { arg0 := "" - if err = json.Unmarshal(b, arg0); err == nil { + if err = json.Unmarshal(b, &arg0); err == nil { obj.Address = arg0 return } diff --git a/rpc/http/server.go b/rpc/http/server.go index 10c8fa813..dd6ba68e3 100644 --- a/rpc/http/server.go +++ b/rpc/http/server.go @@ -30,7 +30,7 @@ var rpchttplogger = logger.NewLogger("RPC-HTTP") var JSON rpc.JsonWrapper func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) { - sport := fmt.Sprintf(":%d", port) + sport := fmt.Sprintf("127.0.0.1:%d", port) l, err := net.Listen("tcp", sport) if err != nil { return nil, err diff --git a/rpc/packages.go b/rpc/packages.go index ac3127356..ef31ff1e1 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -109,8 +109,8 @@ func (self *EthereumApi) NewFilterString(args string, reply *interface{}) error } func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error { - self.logMut.RLock() - defer self.logMut.RUnlock() + self.logMut.Lock() + defer self.logMut.Unlock() *reply = toLogs(self.logs[id]) @@ -309,8 +309,8 @@ func (p *EthereumApi) NewWhisperFilter(args *xeth.Options, reply *interface{}) e } func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error { - self.messagesMut.RLock() - defer self.messagesMut.RUnlock() + self.messagesMut.Lock() + defer self.messagesMut.Unlock() *reply = self.messages[id] |