mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 21:07:17 +00:00
Merge branch 'develop' into bounty
This commit is contained in:
commit
c924a841c7
@ -168,7 +168,7 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block {
|
|||||||
var root []byte
|
var root []byte
|
||||||
parentHash := ZeroHash256
|
parentHash := ZeroHash256
|
||||||
|
|
||||||
if bc.CurrentBlock != nil {
|
if bc.currentBlock != nil {
|
||||||
root = bc.currentBlock.Header().Root
|
root = bc.currentBlock.Header().Root
|
||||||
parentHash = bc.lastBlockHash
|
parentHash = bc.lastBlockHash
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,9 @@ import "C"
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/ethereum/go-ethereum/crypto/randentropy"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto/randentropy"
|
||||||
)
|
)
|
||||||
|
|
||||||
//#define USE_FIELD_5X64
|
//#define USE_FIELD_5X64
|
||||||
@ -85,6 +86,10 @@ func GenerateKeyPair() ([]byte, []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GeneratePubKey(seckey []byte) ([]byte, error) {
|
func GeneratePubKey(seckey []byte) ([]byte, error) {
|
||||||
|
if err := VerifySeckeyValidity(seckey); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
pubkey_len := C.int(65)
|
pubkey_len := C.int(65)
|
||||||
const seckey_len = 32
|
const seckey_len = 32
|
||||||
|
|
||||||
|
@ -436,15 +436,15 @@ func (self *BlacklistMap) Exists(pubkey []byte) (ok bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *BlacklistMap) Put(pubkey []byte) error {
|
func (self *BlacklistMap) Put(pubkey []byte) error {
|
||||||
self.lock.RLock()
|
self.lock.Lock()
|
||||||
defer self.lock.RUnlock()
|
defer self.lock.Unlock()
|
||||||
self.blacklist[string(pubkey)] = true
|
self.blacklist[string(pubkey)] = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *BlacklistMap) Delete(pubkey []byte) error {
|
func (self *BlacklistMap) Delete(pubkey []byte) error {
|
||||||
self.lock.RLock()
|
self.lock.Lock()
|
||||||
defer self.lock.RUnlock()
|
defer self.lock.Unlock()
|
||||||
delete(self.blacklist, string(pubkey))
|
delete(self.blacklist, string(pubkey))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ type PushTxArgs struct {
|
|||||||
|
|
||||||
func (obj *PushTxArgs) UnmarshalJSON(b []byte) (err error) {
|
func (obj *PushTxArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
arg0 := ""
|
arg0 := ""
|
||||||
if err = json.Unmarshal(b, arg0); err == nil {
|
if err = json.Unmarshal(b, &arg0); err == nil {
|
||||||
obj.Tx = arg0
|
obj.Tx = arg0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ type GetStateArgs struct {
|
|||||||
|
|
||||||
func (obj *GetStateArgs) UnmarshalJSON(b []byte) (err error) {
|
func (obj *GetStateArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
arg0 := ""
|
arg0 := ""
|
||||||
if err = json.Unmarshal(b, arg0); err == nil {
|
if err = json.Unmarshal(b, &arg0); err == nil {
|
||||||
obj.Address = arg0
|
obj.Address = arg0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ type GetTxCountArgs struct {
|
|||||||
|
|
||||||
func (obj *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) {
|
func (obj *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) {
|
||||||
arg0 := ""
|
arg0 := ""
|
||||||
if err = json.Unmarshal(b, arg0); err == nil {
|
if err = json.Unmarshal(b, &arg0); err == nil {
|
||||||
obj.Address = arg0
|
obj.Address = arg0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ var rpchttplogger = logger.NewLogger("RPC-HTTP")
|
|||||||
var JSON rpc.JsonWrapper
|
var JSON rpc.JsonWrapper
|
||||||
|
|
||||||
func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) {
|
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)
|
l, err := net.Listen("tcp", sport)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -109,8 +109,8 @@ func (self *EthereumApi) NewFilterString(args string, reply *interface{}) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error {
|
func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error {
|
||||||
self.logMut.RLock()
|
self.logMut.Lock()
|
||||||
defer self.logMut.RUnlock()
|
defer self.logMut.Unlock()
|
||||||
|
|
||||||
*reply = toLogs(self.logs[id])
|
*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 {
|
func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error {
|
||||||
self.messagesMut.RLock()
|
self.messagesMut.Lock()
|
||||||
defer self.messagesMut.RUnlock()
|
defer self.messagesMut.Unlock()
|
||||||
|
|
||||||
*reply = self.messages[id]
|
*reply = self.messages[id]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user