aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/mist/assets/examples/abi.html2
-rw-r--r--cmd/mist/assets/examples/coin.html22
-rw-r--r--cmd/mist/assets/examples/info.html5
-rw-r--r--core/block_processor.go87
-rw-r--r--core/chain_manager.go3
-rw-r--r--core/filter.go7
-rw-r--r--core/types/block.go26
-rw-r--r--core/types/common.go8
-rw-r--r--event/filter/old_filter.go2
-rw-r--r--miner/worker.go169
-rw-r--r--pow/ezp/pow.go2
-rw-r--r--rpc/http/server.go4
-rw-r--r--rpc/message.go1
-rw-r--r--rpc/util.go5
-rw-r--r--xeth/whisper.go7
15 files changed, 271 insertions, 79 deletions
diff --git a/cmd/mist/assets/examples/abi.html b/cmd/mist/assets/examples/abi.html
index 8d172482c..8170e88b0 100644
--- a/cmd/mist/assets/examples/abi.html
+++ b/cmd/mist/assets/examples/abi.html
@@ -21,7 +21,7 @@
}];
var address = web3.eth.transact({
data: "0x603880600c6000396000f3006001600060e060020a600035048063c6888fa114601857005b6021600435602b565b8060005260206000f35b600081600702905091905056",
- gasprice: "1000000000000000",
+ gasPrice: "1000000000000000",
gas: "10000",
});
var contract = web3.eth.contract(address, desc);
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html
index edeabe5e8..070ac94a6 100644
--- a/cmd/mist/assets/examples/coin.html
+++ b/cmd/mist/assets/examples/coin.html
@@ -32,17 +32,19 @@
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
var desc = [{
"name": "balance(address)",
+ "type": "function",
"inputs": [{
"name": "who",
"type": "address"
}],
- "const": true,
+ "constant": true,
"outputs": [{
"name": "value",
"type": "uint256"
}]
}, {
"name": "send(address,uint256)",
+ "type": "function",
"inputs": [{
"name": "to",
"type": "address"
@@ -51,21 +53,31 @@
"type": "uint256"
}],
"outputs": []
+ }, {
+ "name":"Changed",
+ "type":"event",
+ "inputs": [
+ {"name":"to","type":"address","indexed":false},
+ {"name":"amount","type":"uint256","indexed":true},
+ ],
}];
- var address = web3.db.get("jevcoin", "address");
+ var address = "";//web3.db.get("jevcoin", "address");
if( address.length == 0 ) {
- var code = "0x60056011565b60ae8060356000396000f35b64174876e800600033600160a060020a031660005260205260406000208190555056006001600060e060020a600035048063d0679d34146022578063e3d670d714603457005b602e6004356024356047565b60006000f35b603d600435608d565b8060005260206000f35b80600083600160a060020a0316600052602052604060002090815401908190555080600033600160a060020a031660005260205260406000209081540390819055505050565b6000600082600160a060020a0316600052602052604060002054905091905056";
+ var code = "0x60056011565b60b88060356000396000f35b64e8d4a51000600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a68146028578063d0679d34146034578063e3d670d714604657005b602e60b3565b60006000f35b60406004356024356059565b60006000f35b604f6004356091565b8060005260206000f35b8060005281600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660206000a25050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156";
address = web3.eth.transact({
data: code,
- gasprice: "1000000000000000",
+ gasPrice: "1000000000000000",
gas: "10000",
});
web3.db.put("jevcoin", "address", address);
}
var contract = web3.eth.contract(address, desc);
-
+ contract.Changed({to: "0xaabb"}).changed(function(e) {
+ console.log("e: " + JSON.stringify(e));
+ });
+ contract.transact({gas: "10000", gasprice: eth.gasPrice}).send( "0xaa", 10000 );
function reflesh() {
document.querySelector("#balance").innerHTML = contract.call().balance(eth.coinbase);
diff --git a/cmd/mist/assets/examples/info.html b/cmd/mist/assets/examples/info.html
index c4df8ea64..daad8c706 100644
--- a/cmd/mist/assets/examples/info.html
+++ b/cmd/mist/assets/examples/info.html
@@ -31,6 +31,10 @@
</tr>
<tr>
+ <td>Balance</td>
+ <td id="balance"></td>
+
+ <tr>
<td>Gas price</td>
<td id="gas_price"></td>
</tr>
@@ -63,6 +67,7 @@
document.querySelector("#peer_count").innerHTML = eth.peerCount;
document.querySelector("#default_block").innerHTML = eth.defaultBlock;
document.querySelector("#accounts").innerHTML = eth.accounts;
+ document.querySelector("#balance").innerHTML = web3.toEth(eth.balanceAt(eth.accounts[0]));
document.querySelector("#gas_price").innerHTML = eth.gasPrice;
document.querySelector("#mining").innerHTML = eth.mining;
document.querySelector("#listening").innerHTML = eth.listening;
diff --git a/core/block_processor.go b/core/block_processor.go
index 4d5cd94c9..d59d7feca 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -84,6 +84,37 @@ func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block
return receipts, nil
}
+func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, state *state.StateDB, block *types.Block, tx *types.Transaction, usedGas *big.Int, transientProcess bool) (*types.Receipt, *big.Int, error) {
+ // If we are mining this block and validating we want to set the logs back to 0
+ state.EmptyLogs()
+
+ txGas := new(big.Int).Set(tx.Gas())
+
+ cb := state.GetStateObject(coinbase.Address())
+ st := NewStateTransition(NewEnv(state, self.bc, tx, block), tx, cb)
+ _, err := st.TransitionState()
+
+ txGas.Sub(txGas, st.gas)
+
+ // Update the state with pending changes
+ state.Update(txGas)
+
+ cumulative := new(big.Int).Set(usedGas.Add(usedGas, txGas))
+ receipt := types.NewReceipt(state.Root(), cumulative)
+ receipt.SetLogs(state.Logs())
+ receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
+ chainlogger.Debugln(receipt)
+
+ // Notify all subscribers
+ if !transientProcess {
+ go self.eventMux.Post(TxPostEvent{tx})
+ }
+
+ go self.eventMux.Post(state.Logs())
+
+ return receipt, txGas, err
+}
+
func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) {
var (
receipts types.Receipts
@@ -96,15 +127,10 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
done:
for i, tx := range txs {
- // If we are mining this block and validating we want to set the logs back to 0
- state.EmptyLogs()
-
- txGas := new(big.Int).Set(tx.Gas())
-
- cb := state.GetStateObject(coinbase.Address())
- st := NewStateTransition(NewEnv(state, self.bc, tx, block), tx, cb)
- _, err = st.TransitionState()
+ receipt, txGas, err := self.ApplyTransaction(coinbase, state, block, tx, totalUsedGas, transientProcess)
if err != nil {
+ return nil, nil, nil, nil, err
+
switch {
case IsNonceErr(err):
err = nil // ignore error
@@ -119,30 +145,10 @@ done:
err = nil
}
}
-
- txGas.Sub(txGas, st.gas)
- cumulativeSum.Add(cumulativeSum, new(big.Int).Mul(txGas, tx.GasPrice()))
-
- // Update the state with pending changes
- state.Update(txGas)
-
- cumulative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, txGas))
- receipt := types.NewReceipt(state.Root(), cumulative)
- receipt.SetLogs(state.Logs())
- receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
- chainlogger.Debugln(receipt)
-
- // Notify all subscribers
- if !transientProcess {
- go self.eventMux.Post(TxPostEvent{tx})
- }
-
receipts = append(receipts, receipt)
handled = append(handled, tx)
- if ethutil.Config.Diff && ethutil.Config.DiffType == "all" {
- state.CreateOutputForDiff()
- }
+ cumulativeSum.Add(cumulativeSum, new(big.Int).Mul(txGas, tx.GasPrice()))
}
block.Reward = cumulativeSum
@@ -151,25 +157,25 @@ done:
return receipts, handled, unhandled, erroneous, err
}
-func (sm *BlockProcessor) Process(block *types.Block) (td *big.Int, msgs state.Messages, err error) {
+func (sm *BlockProcessor) Process(block *types.Block) (td *big.Int, err error) {
// Processing a blocks may never happen simultaneously
sm.mutex.Lock()
defer sm.mutex.Unlock()
header := block.Header()
if sm.bc.HasBlock(header.Hash()) {
- return nil, nil, &KnownBlockError{header.Number, header.Hash()}
+ return nil, &KnownBlockError{header.Number, header.Hash()}
}
if !sm.bc.HasBlock(header.ParentHash) {
- return nil, nil, ParentError(header.ParentHash)
+ return nil, ParentError(header.ParentHash)
}
parent := sm.bc.GetBlock(header.ParentHash)
return sm.ProcessWithParent(block, parent)
}
-func (sm *BlockProcessor) ProcessWithParent(block, parent *types.Block) (td *big.Int, messages state.Messages, err error) {
+func (sm *BlockProcessor) ProcessWithParent(block, parent *types.Block) (td *big.Int, err error) {
sm.lastAttemptedBlock = block
state := state.New(parent.Root(), sm.db)
@@ -223,7 +229,6 @@ func (sm *BlockProcessor) ProcessWithParent(block, parent *types.Block) (td *big
state.Sync()
// Set the block hashes for the current messages
state.Manifest().SetHash(block.Hash())
- messages = state.Manifest().Messages
// Reset the manifest XXX We need this?
state.Manifest().Reset()
// Remove transactions from the pool
@@ -231,7 +236,7 @@ func (sm *BlockProcessor) ProcessWithParent(block, parent *types.Block) (td *big
chainlogger.Infof("processed block #%d (%x...)\n", header.Number, block.Hash()[0:4])
- return td, messages, nil
+ return td, nil
}
// Validates the current block. Returns an error if the block was invalid,
@@ -285,6 +290,10 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren
return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4]))
}
+ if !sm.Pow.Verify(types.NewBlockWithHeader(uncle)) {
+ return ValidationError("Uncle's nonce is invalid (= %v)", ethutil.Bytes2Hex(uncle.Nonce))
+ }
+
r := new(big.Int)
r.Mul(BlockReward, big.NewInt(15)).Div(r, big.NewInt(16))
@@ -299,14 +308,6 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren
// Reward amount of ether to the coinbase address
account.AddAmount(reward)
- statedb.Manifest().AddMessage(&state.Message{
- To: block.Header().Coinbase,
- Input: nil,
- Origin: nil,
- Timestamp: int64(block.Header().Time), Coinbase: block.Header().Coinbase, Number: block.Header().Number,
- Value: new(big.Int).Add(reward, block.Reward),
- })
-
return nil
}
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 9646bfc53..0847980ca 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -359,7 +359,7 @@ func (bc *ChainManager) Stop() {
func (self *ChainManager) InsertChain(chain types.Blocks) error {
for _, block := range chain {
- td, messages, err := self.processor.Process(block)
+ td, err := self.processor.Process(block)
if err != nil {
if IsKnownBlockErr(err) {
continue
@@ -391,7 +391,6 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
self.mu.Unlock()
self.eventMux.Post(NewBlockEvent{block})
- self.eventMux.Post(messages)
}
return nil
diff --git a/core/filter.go b/core/filter.go
index d154e7b7a..a458165f5 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -2,6 +2,7 @@ package core
import (
"bytes"
+ "fmt"
"math"
"github.com/ethereum/go-ethereum/core/types"
@@ -130,6 +131,7 @@ func (self *Filter) Find() state.Logs {
func includes(addresses [][]byte, a []byte) (found bool) {
for _, addr := range addresses {
+ fmt.Println("INCLUDES", addr, a)
if bytes.Compare(addr, a) == 0 {
return true
}
@@ -139,20 +141,25 @@ func includes(addresses [][]byte, a []byte) (found bool) {
}
func (self *Filter) FilterLogs(logs state.Logs) state.Logs {
+ fmt.Println("FILTER LOGS", self.topics)
var ret state.Logs
// Filter the logs for interesting stuff
for _, log := range logs {
+ fmt.Println(log)
+
if len(self.address) > 0 && !bytes.Equal(self.address, log.Address()) {
continue
}
for _, topic := range self.topics {
+ fmt.Println("TOPIC:", topic)
if !includes(log.Topics(), topic) {
continue
}
}
+ fmt.Println("APPENDED")
ret = append(ret, log)
}
diff --git a/core/types/block.go b/core/types/block.go
index be57e86a6..a334c512e 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -6,7 +6,6 @@ import (
"math/big"
"sort"
"time"
-
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/rlp"
@@ -146,6 +145,10 @@ func (self *Block) SetTransactions(transactions Transactions) {
self.transactions = transactions
self.header.TxHash = DeriveSha(transactions)
}
+func (self *Block) AddTransaction(transaction *Transaction) {
+ self.transactions = append(self.transactions, transaction)
+ self.SetTransactions(self.transactions)
+}
func (self *Block) Receipts() Receipts {
return self.receipts
@@ -156,6 +159,10 @@ func (self *Block) SetReceipts(receipts Receipts) {
self.header.ReceiptHash = DeriveSha(receipts)
self.header.Bloom = CreateBloom(receipts)
}
+func (self *Block) AddReceipt(receipt *Receipt) {
+ self.receipts = append(self.receipts, receipt)
+ self.SetReceipts(self.receipts)
+}
func (self *Block) RlpData() interface{} {
return []interface{}{self.header, self.transactions, self.uncles}
@@ -166,16 +173,13 @@ func (self *Block) RlpDataForStorage() interface{} {
}
// Header accessors (add as you need them)
-func (self *Block) Number() *big.Int { return self.header.Number }
-func (self *Block) NumberU64() uint64 { return self.header.Number.Uint64() }
-func (self *Block) Bloom() []byte { return self.header.Bloom }
-func (self *Block) Coinbase() []byte { return self.header.Coinbase }
-func (self *Block) Time() int64 { return int64(self.header.Time) }
-func (self *Block) GasLimit() *big.Int { return self.header.GasLimit }
-func (self *Block) GasUsed() *big.Int { return self.header.GasUsed }
-
-//func (self *Block) Trie() *ptrie.Trie { return ptrie.New(self.header.Root, ethutil.Config.Db) }
-//func (self *Block) State() *state.StateDB { return state.New(self.Trie()) }
+func (self *Block) Number() *big.Int { return self.header.Number }
+func (self *Block) NumberU64() uint64 { return self.header.Number.Uint64() }
+func (self *Block) Bloom() []byte { return self.header.Bloom }
+func (self *Block) Coinbase() []byte { return self.header.Coinbase }
+func (self *Block) Time() int64 { return int64(self.header.Time) }
+func (self *Block) GasLimit() *big.Int { return self.header.GasLimit }
+func (self *Block) GasUsed() *big.Int { return self.header.GasUsed }
func (self *Block) Root() []byte { return self.header.Root }
func (self *Block) SetRoot(root []byte) { self.header.Root = root }
func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) }
diff --git a/core/types/common.go b/core/types/common.go
index ba88b77e1..795374959 100644
--- a/core/types/common.go
+++ b/core/types/common.go
@@ -1,11 +1,7 @@
package types
-import (
- "math/big"
-
- "github.com/ethereum/go-ethereum/state"
-)
+import "math/big"
type BlockProcessor interface {
- Process(*Block) (*big.Int, state.Messages, error)
+ Process(*Block) (*big.Int, error)
}
diff --git a/event/filter/old_filter.go b/event/filter/old_filter.go
index c30a7e584..4c01572db 100644
--- a/event/filter/old_filter.go
+++ b/event/filter/old_filter.go
@@ -59,7 +59,7 @@ func (self *FilterManager) GetFilter(id int) *core.Filter {
func (self *FilterManager) filterLoop() {
// Subscribe to events
- events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil))
+ events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Logs(nil))
out:
for {
diff --git a/miner/worker.go b/miner/worker.go
new file mode 100644
index 000000000..ea8f2e8b5
--- /dev/null
+++ b/miner/worker.go
@@ -0,0 +1,169 @@
+package miner
+
+import (
+ "fmt"
+ "math/big"
+ "sort"
+
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/eth"
+ "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/pow"
+ "github.com/ethereum/go-ethereum/state"
+ "gopkg.in/fatih/set.v0"
+)
+
+type environment struct {
+ totalUsedGas *big.Int
+ state *state.StateDB
+ coinbase *state.StateObject
+ block *types.Block
+ ancestors *set.Set
+ uncles *set.Set
+}
+
+func env(block *types.Block, eth *eth.Ethereum) *environment {
+ state := state.New(block.Root(), eth.Db())
+ env := &environment{
+ totalUsedGas: new(big.Int),
+ state: state,
+ block: block,
+ ancestors: set.New(),
+ uncles: set.New(),
+ coinbase: state.GetOrNewStateObject(block.Coinbase()),
+ }
+ for _, ancestor := range eth.ChainManager().GetAncestors(block, 7) {
+ env.ancestors.Add(string(ancestor.Hash()))
+ }
+
+ return env
+}
+
+type Agent interface {
+ Comms() chan<- *types.Block
+}
+
+type worker struct {
+ agents []chan<- *types.Block
+ mux *event.TypeMux
+ quit chan struct{}
+ pow pow.PoW
+
+ eth *eth.Ethereum
+ chain *core.ChainManager
+ proc *core.BlockProcessor
+ coinbase []byte
+
+ current *environment
+}
+
+func (self *worker) register(agent chan<- *types.Block) {
+ self.agents = append(self.agents, agent)
+}
+
+func (self *worker) update() {
+ events := self.mux.Subscribe(core.NewBlockEvent{}, core.TxPreEvent{}, &LocalTx{})
+
+out:
+ for {
+ select {
+ case event := <-events.Chan():
+ switch event := event.(type) {
+ case core.NewBlockEvent:
+ if self.eth.ChainManager().HasBlock(event.Block.Hash()) {
+ }
+ case core.TxPreEvent:
+ if err := self.commitTransaction(event.Tx); err != nil {
+ self.commit()
+ }
+ }
+ case <-self.quit:
+ break out
+ }
+ }
+}
+
+func (self *worker) commit() {
+ self.current.state.Update(ethutil.Big0)
+ self.current.block.SetRoot(self.current.state.Root())
+
+ for _, agent := range self.agents {
+ agent <- self.current.block
+ }
+}
+
+func (self *worker) commitNewWork() {
+ self.current = env(self.chain.NewBlock(self.coinbase), self.eth)
+ parent := self.chain.GetBlock(self.current.block.ParentHash())
+ self.current.coinbase.SetGasPool(core.CalcGasLimit(parent, self.current.block))
+
+ transactions := self.eth.TxPool().GetTransactions()
+ sort.Sort(types.TxByNonce{transactions})
+
+ // Keep track of transactions which return errors so they can be removed
+ var remove types.Transactions
+ for _, tx := range transactions {
+ err := self.commitTransaction(tx)
+ switch {
+ case core.IsNonceErr(err):
+ remove = append(remove, tx)
+ case core.IsGasLimitErr(err):
+ // ignore
+ default:
+ minerlogger.Infoln(err)
+ remove = append(remove, tx)
+ }
+ }
+ self.eth.TxPool().RemoveSet(remove)
+
+ self.current.coinbase.AddAmount(core.BlockReward)
+
+ self.commit()
+}
+
+var (
+ inclusionReward = new(big.Int).Div(core.BlockReward, big.NewInt(32))
+ _uncleReward = new(big.Int).Mul(core.BlockReward, big.NewInt(15))
+ uncleReward = new(big.Int).Div(_uncleReward, big.NewInt(16))
+)
+
+func (self *worker) commitUncle(uncle *types.Header) error {
+ if self.current.uncles.Has(string(uncle.Hash())) {
+ // Error not unique
+ return core.UncleError("Uncle not unique")
+ }
+ self.current.uncles.Add(string(uncle.Hash()))
+
+ if !self.current.ancestors.Has(string(uncle.ParentHash)) {
+ return core.UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4]))
+ }
+
+ if !self.pow.Verify(types.NewBlockWithHeader(uncle)) {
+ return core.ValidationError("Uncle's nonce is invalid (= %v)", ethutil.Bytes2Hex(uncle.Nonce))
+ }
+
+ uncleAccount := self.current.state.GetAccount(uncle.Coinbase)
+ uncleAccount.AddAmount(uncleReward)
+
+ self.current.coinbase.AddBalance(uncleReward)
+
+ return nil
+}
+
+func (self *worker) commitTransaction(tx *types.Transaction) error {
+ snapshot := self.current.state.Copy()
+ receipt, txGas, err := self.proc.ApplyTransaction(self.current.coinbase, self.current.state, self.current.block, tx, self.current.totalUsedGas, true)
+ if err != nil {
+ self.current.state.Set(snapshot)
+
+ return err
+ }
+
+ self.current.totalUsedGas.Add(self.current.totalUsedGas, txGas)
+ self.current.block.AddTransaction(tx)
+ self.current.block.AddReceipt(receipt)
+
+ return nil
+}
diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go
index 5abe6950e..64d3230c9 100644
--- a/pow/ezp/pow.go
+++ b/pow/ezp/pow.go
@@ -53,7 +53,7 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
pow.HashRate = int64(hashes)
- powlogger.Infoln("Hashing @", pow.HashRate, "khash")
+ //powlogger.Infoln("Hashing @", pow.HashRate, "khash")
t = time.Now()
}
diff --git a/rpc/http/server.go b/rpc/http/server.go
index 965727a4e..bcfd46234 100644
--- a/rpc/http/server.go
+++ b/rpc/http/server.go
@@ -87,7 +87,7 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler {
fn := func(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
- rpchttplogger.Debugln("Handling request")
+ rpchttplogger.DebugDetailln("Handling request")
reqParsed, reqerr := JSON.ParseRequestBody(req)
if reqerr != nil {
@@ -103,7 +103,7 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler {
return
}
- rpchttplogger.Debugf("Generated response: %T %s", response, response)
+ rpchttplogger.DebugDetailf("Generated response: %T %s", response, response)
JSON.Send(w, &rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response})
}
diff --git a/rpc/message.go b/rpc/message.go
index 26fac9d37..f1e982397 100644
--- a/rpc/message.go
+++ b/rpc/message.go
@@ -206,6 +206,7 @@ func (req *RpcRequest) ToFilterArgs() (*FilterOptions, error) {
if len(req.Params) < 1 {
return nil, NewErrorResponse(ErrorArguments)
}
+ fmt.Println("filter params", req.Params)
args := new(FilterOptions)
r := bytes.NewReader(req.Params[0])
diff --git a/rpc/util.go b/rpc/util.go
index bb4087c51..509d9a17d 100644
--- a/rpc/util.go
+++ b/rpc/util.go
@@ -18,10 +18,11 @@ package rpc
import (
"encoding/json"
- "github.com/ethereum/go-ethereum/logger"
"io"
"net/http"
+
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
)
@@ -36,7 +37,7 @@ func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error)
rpclogger.Fatalln("Error marshalling JSON", err)
return 0, err
}
- rpclogger.Infof("Sending payload: %s", payload)
+ rpclogger.DebugDetailf("Sending payload: %s", payload)
return writer.Write(payload)
}
diff --git a/xeth/whisper.go b/xeth/whisper.go
index 42d7c44bc..52f4593e4 100644
--- a/xeth/whisper.go
+++ b/xeth/whisper.go
@@ -2,11 +2,9 @@ package xeth
import (
"errors"
- "fmt"
"time"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/whisper"
)
@@ -32,7 +30,6 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
pk := crypto.ToECDSAPub(fromHex(from))
if key := self.Whisper.GetIdentity(pk); key != nil || len(from) == 0 {
- fmt.Println("POST:", to)
msg := whisper.NewMessage(fromHex(payload))
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
Ttl: time.Duration(ttl) * time.Second,
@@ -109,8 +106,8 @@ type WhisperMessage struct {
func NewWhisperMessage(msg *whisper.Message) WhisperMessage {
return WhisperMessage{
ref: msg,
- Payload: "0x" + ethutil.Bytes2Hex(msg.Payload),
- From: "0x" + ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())),
+ Payload: toHex(msg.Payload),
+ From: toHex(crypto.FromECDSAPub(msg.Recover())),
Sent: msg.Sent,
}
}