Merge branch 'develop' into bounty

This commit is contained in:
obscuren 2015-02-15 02:29:52 +01:00
commit c924a841c7
6 changed files with 19 additions and 14 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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]