aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/mist/assets/examples/coin.html5
-rw-r--r--cmd/mist/gui.go2
-rw-r--r--core/chain_manager.go13
-rw-r--r--core/filter.go23
-rw-r--r--eth/backend.go1
-rw-r--r--logger/types.go6
-rw-r--r--pow/ezp/pow.go2
-rw-r--r--rpc/args.go18
-rw-r--r--state/state_object.go25
-rw-r--r--ui/filter.go4
10 files changed, 76 insertions, 23 deletions
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html
index ca7a9c0dd..cb9d471de 100644
--- a/cmd/mist/assets/examples/coin.html
+++ b/cmd/mist/assets/examples/coin.html
@@ -80,11 +80,6 @@
refresh();
});
- var ev = contract.SingleTransact({})
- ev.watch(function(log) {
- someElement.innerHTML += "tnaheousnthaoeu";
- });
-
eth.watch('chain').changed(function() {
refresh();
});
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 9ce6ba650..886a5811b 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -394,7 +394,6 @@ func (gui *Gui) update() {
miningLabel := gui.getObjectByName("miningLabel")
events := gui.eth.EventMux().Subscribe(
- //eth.PeerListEvent{},
core.NewBlockEvent{},
core.TxPreEvent{},
core.TxPostEvent{},
@@ -410,7 +409,6 @@ func (gui *Gui) update() {
switch ev := ev.(type) {
case core.NewBlockEvent:
gui.processBlock(ev.Block, false)
- //gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address()))
gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance))
diff --git a/core/chain_manager.go b/core/chain_manager.go
index c28e901c6..025615676 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -79,6 +79,7 @@ type ChainManager struct {
genesisBlock *types.Block
// Last known total difficulty
mu sync.RWMutex
+ tsmu sync.RWMutex
td *big.Int
currentBlock *types.Block
lastBlockHash []byte
@@ -131,9 +132,19 @@ func (self *ChainManager) State() *state.StateDB {
}
func (self *ChainManager) TransState() *state.StateDB {
+ self.tsmu.RLock()
+ defer self.tsmu.RUnlock()
+ //tmp := self.transState
+
return self.transState
}
+func (self *ChainManager) setTransState(statedb *state.StateDB) {
+ self.tsmu.Lock()
+ defer self.tsmu.Unlock()
+ self.transState = statedb
+}
+
func (bc *ChainManager) setLastBlock() {
data, _ := bc.db.Get([]byte("LastBlock"))
if len(data) != 0 {
@@ -376,7 +387,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
self.setTotalDifficulty(td)
self.insert(block)
- self.transState = state.New(cblock.Root(), self.db)
+ self.setTransState(state.New(cblock.Root(), self.db))
self.eventMux.Post(ChainEvent{block, td})
}
diff --git a/core/filter.go b/core/filter.go
index 234fa3316..88f12a67c 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -16,7 +16,7 @@ type FilterOptions struct {
Earliest int64
Latest int64
- Address []byte
+ Address [][]byte
Topics [][]byte
Skip int
@@ -29,7 +29,7 @@ type Filter struct {
earliest int64
latest int64
skip int
- address []byte
+ address [][]byte
max int
topics [][]byte
@@ -65,7 +65,7 @@ func (self *Filter) SetLatestBlock(latest int64) {
self.latest = latest
}
-func (self *Filter) SetAddress(addr []byte) {
+func (self *Filter) SetAddress(addr [][]byte) {
self.address = addr
}
@@ -145,7 +145,8 @@ func (self *Filter) FilterLogs(logs state.Logs) state.Logs {
// Filter the logs for interesting stuff
Logs:
for _, log := range logs {
- if !bytes.Equal(self.address, log.Address()) {
+ if !includes(self.address, log.Address()) {
+ //if !bytes.Equal(self.address, log.Address()) {
continue
}
@@ -163,8 +164,18 @@ Logs:
}
func (self *Filter) bloomFilter(block *types.Block) bool {
- if len(self.address) > 0 && !types.BloomLookup(block.Bloom(), self.address) {
- return false
+ if len(self.address) > 0 {
+ var included bool
+ for _, addr := range self.address {
+ if types.BloomLookup(block.Bloom(), addr) {
+ included = true
+ break
+ }
+ }
+
+ if !included {
+ return false
+ }
}
for _, topic := range self.topics {
diff --git a/eth/backend.go b/eth/backend.go
index 690c7136d..7685f3568 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -26,6 +26,7 @@ var (
defaultBootNodes = []*discover.Node{
discover.MustParseNode("enode://6cdd090303f394a1cac34ecc9f7cda18127eafa2a3a06de39f6d920b0e583e062a7362097c7c65ee490a758b442acd5c80c6fce4b148c6a391e946b45131365b@54.169.166.226:30303"),
+ discover.MustParseNode("enode://d1760a33c2f25c3b419ee4f6787fb0ea148828f5e678f0450d4be978fef908b42fc47a4c0fbf19832754f17881d381e50364fa93be42f31801d60ac64933f0a5@127.0.0.1:30303"),
}
)
diff --git a/logger/types.go b/logger/types.go
index f8dcb4e78..419382231 100644
--- a/logger/types.go
+++ b/logger/types.go
@@ -44,8 +44,10 @@ func (l *P2PConnecting) EventName() string {
}
type P2PConnected struct {
- NumConnections int `json:"num_connections"`
- RemoteId string `json:"remote_id"`
+ RemoteId string `json:"remote_id"`
+ RemoteAddress string `json:"remote_addr"`
+ RemoteVersionString string `json:"remote_version_string"`
+ NumConnections int `json:"num_connections"`
LogEvent
}
diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go
index 540381243..f4a8b80e5 100644
--- a/pow/ezp/pow.go
+++ b/pow/ezp/pow.go
@@ -21,7 +21,7 @@ type EasyPow struct {
}
func New() *EasyPow {
- return &EasyPow{turbo: false}
+ return &EasyPow{turbo: true}
}
func (pow *EasyPow) GetHashrate() int64 {
diff --git a/rpc/args.go b/rpc/args.go
index 12e3103bc..9c2c7d7a6 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -1,6 +1,7 @@
package rpc
import "encoding/json"
+
import "github.com/ethereum/go-ethereum/core"
type GetBlockArgs struct {
@@ -203,7 +204,7 @@ func (obj *Sha3Args) UnmarshalJSON(b []byte) (err error) {
type FilterOptions struct {
Earliest int64
Latest int64
- Address string
+ Address interface{}
Topic []string
Skip int
Max int
@@ -211,9 +212,22 @@ type FilterOptions struct {
func toFilterOptions(options *FilterOptions) core.FilterOptions {
var opts core.FilterOptions
+
+ // Convert optional address slice/string to byte slice
+ if str, ok := options.Address.(string); ok {
+ opts.Address = [][]byte{fromHex(str)}
+ } else if slice, ok := options.Address.([]interface{}); ok {
+ bslice := make([][]byte, len(slice))
+ for i, addr := range slice {
+ if saddr, ok := addr.(string); ok {
+ bslice[i] = fromHex(saddr)
+ }
+ }
+ opts.Address = bslice
+ }
+
opts.Earliest = options.Earliest
opts.Latest = options.Latest
- opts.Address = fromHex(options.Address)
opts.Topics = make([][]byte, len(options.Topic))
for i, topic := range options.Topic {
opts.Topics[i] = fromHex(topic)
diff --git a/state/state_object.go b/state/state_object.go
index 340939a5d..0c157403c 100644
--- a/state/state_object.go
+++ b/state/state_object.go
@@ -1,11 +1,13 @@
package state
import (
+ "bytes"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
)
@@ -71,8 +73,28 @@ func NewStateObject(addr []byte, db ethutil.Database) *StateObject {
}
func NewStateObjectFromBytes(address, data []byte, db ethutil.Database) *StateObject {
+ // TODO clean me up
+ var extobject struct {
+ Nonce uint64
+ Balance *big.Int
+ Root []byte
+ CodeHash []byte
+ }
+ err := rlp.Decode(bytes.NewReader(data), &extobject)
+ if err != nil {
+ fmt.Println(err)
+ return nil
+ }
+
object := &StateObject{address: address, db: db}
- object.RlpDecode(data)
+ //object.RlpDecode(data)
+ object.Nonce = extobject.Nonce
+ object.balance = extobject.Balance
+ object.codeHash = extobject.CodeHash
+ object.State = New(extobject.Root, db)
+ object.storage = make(map[string]*ethutil.Value)
+ object.gasPool = new(big.Int)
+ object.Code, _ = db.Get(extobject.CodeHash)
return object
}
@@ -271,7 +293,6 @@ func (c *StateObject) CodeHash() ethutil.Bytes {
func (c *StateObject) RlpDecode(data []byte) {
decoder := ethutil.NewValueFromBytes(data)
-
c.Nonce = decoder.Get(0).Uint()
c.balance = decoder.Get(1).BigInt()
c.State = New(decoder.Get(2).Bytes(), c.db) //New(trie.New(ethutil.Config.Db, decoder.Get(2).Interface()))
diff --git a/ui/filter.go b/ui/filter.go
index da2ea0edb..0d1746915 100644
--- a/ui/filter.go
+++ b/ui/filter.go
@@ -29,8 +29,8 @@ func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Fil
}
if object["address"] != nil {
- val := ethutil.NewValue(object["address"])
- filter.SetAddress(fromHex(val.Str()))
+ //val := ethutil.NewValue(object["address"])
+ //filter.SetAddress(fromHex(val.Str()))
}
if object["max"] != nil {