Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
16f417f5
Commit
16f417f5
authored
Jan 02, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug where logging could crash client during tx adding
parent
5c82fdc2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
24 deletions
+24
-24
repl.go
cmd/ethereum/repl/repl.go
+1
-0
transaction_pool.go
core/transaction_pool.go
+9
-1
backend.go
eth/backend.go
+4
-2
types.go
javascript/types.go
+10
-20
analysis.go
vm/analysis.go
+0
-1
No files found.
cmd/ethereum/repl/repl.go
View file @
16f417f5
...
@@ -86,6 +86,7 @@ func (self *JSRepl) Stop() {
...
@@ -86,6 +86,7 @@ func (self *JSRepl) Stop() {
}
}
func
(
self
*
JSRepl
)
parseInput
(
code
string
)
{
func
(
self
*
JSRepl
)
parseInput
(
code
string
)
{
value
,
err
:=
self
.
re
.
Run
(
code
)
value
,
err
:=
self
.
re
.
Run
(
code
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
...
...
core/transaction_pool.go
View file @
16f417f5
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"fmt"
"fmt"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"gopkg.in/fatih/set.v0"
"gopkg.in/fatih/set.v0"
...
@@ -107,7 +108,14 @@ func (self *TxPool) Add(tx *types.Transaction) error {
...
@@ -107,7 +108,14 @@ func (self *TxPool) Add(tx *types.Transaction) error {
self
.
addTransaction
(
tx
)
self
.
addTransaction
(
tx
)
txplogger
.
Debugf
(
"(t) %x => %x (%v) %x
\n
"
,
tx
.
From
()[
:
4
],
tx
.
To
()[
:
4
],
tx
.
Value
,
tx
.
Hash
())
var
to
string
if
len
(
tx
.
To
())
>
0
{
to
=
ethutil
.
Bytes2Hex
(
tx
.
To
()[
:
4
])
}
else
{
to
=
"[NEW_CONTRACT]"
}
txplogger
.
Debugf
(
"(t) %x => %s (%v) %x
\n
"
,
tx
.
From
()[
:
4
],
to
,
tx
.
Value
,
tx
.
Hash
())
// Notify the subscribers
// Notify the subscribers
go
self
.
eventMux
.
Post
(
TxPreEvent
{
tx
})
go
self
.
eventMux
.
Post
(
TxPreEvent
{
tx
})
...
...
eth/backend.go
View file @
16f417f5
...
@@ -234,8 +234,10 @@ func (self *Ethereum) txBroadcastLoop() {
...
@@ -234,8 +234,10 @@ func (self *Ethereum) txBroadcastLoop() {
func
(
self
*
Ethereum
)
blockBroadcastLoop
()
{
func
(
self
*
Ethereum
)
blockBroadcastLoop
()
{
// automatically stops if unsubscribe
// automatically stops if unsubscribe
for
obj
:=
range
self
.
txSub
.
Chan
()
{
for
obj
:=
range
self
.
txSub
.
Chan
()
{
event
:=
obj
.
(
core
.
NewMinedBlockEvent
)
switch
ev
:=
obj
.
(
type
)
{
self
.
server
.
Broadcast
(
"eth"
,
NewBlockMsg
,
event
.
Block
.
RlpData
())
case
core
.
NewMinedBlockEvent
:
self
.
server
.
Broadcast
(
"eth"
,
NewBlockMsg
,
ev
.
Block
.
RlpData
())
}
}
}
}
}
...
...
javascript/types.go
View file @
16f417f5
...
@@ -72,15 +72,21 @@ type JSEthereum struct {
...
@@ -72,15 +72,21 @@ type JSEthereum struct {
ethereum
*
eth
.
Ethereum
ethereum
*
eth
.
Ethereum
}
}
func
(
self
*
JSEthereum
)
GetBlock
(
hash
string
)
otto
.
Value
{
func
(
self
*
JSEthereum
)
Block
(
v
interface
{})
otto
.
Value
{
return
self
.
toVal
(
&
JSBlock
{
self
.
JSXEth
.
BlockByHash
(
hash
),
self
})
if
number
,
ok
:=
v
.
(
int64
);
ok
{
return
self
.
toVal
(
&
JSBlock
{
self
.
JSXEth
.
BlockByNumber
(
int32
(
number
)),
self
})
}
else
if
hash
,
ok
:=
v
.
(
string
);
ok
{
return
self
.
toVal
(
&
JSBlock
{
self
.
JSXEth
.
BlockByHash
(
hash
),
self
})
}
return
otto
.
UndefinedValue
()
}
}
func
(
self
*
JSEthereum
)
Get
Peers
()
otto
.
Value
{
func
(
self
*
JSEthereum
)
Peers
()
otto
.
Value
{
return
self
.
toVal
(
self
.
JSXEth
.
Peers
())
return
self
.
toVal
(
self
.
JSXEth
.
Peers
())
}
}
func
(
self
*
JSEthereum
)
Get
Key
()
otto
.
Value
{
func
(
self
*
JSEthereum
)
Key
()
otto
.
Value
{
return
self
.
toVal
(
self
.
JSXEth
.
Key
())
return
self
.
toVal
(
self
.
JSXEth
.
Key
())
}
}
...
@@ -88,10 +94,6 @@ func (self *JSEthereum) GetStateObject(addr string) otto.Value {
...
@@ -88,10 +94,6 @@ func (self *JSEthereum) GetStateObject(addr string) otto.Value {
return
self
.
toVal
(
&
JSStateObject
{
xeth
.
NewJSObject
(
self
.
JSXEth
.
World
()
.
SafeGet
(
ethutil
.
Hex2Bytes
(
addr
))),
self
})
return
self
.
toVal
(
&
JSStateObject
{
xeth
.
NewJSObject
(
self
.
JSXEth
.
World
()
.
SafeGet
(
ethutil
.
Hex2Bytes
(
addr
))),
self
})
}
}
func
(
self
*
JSEthereum
)
Peers
()
otto
.
Value
{
return
self
.
toVal
(
self
.
JSXEth
.
Peers
())
}
func
(
self
*
JSEthereum
)
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
string
)
otto
.
Value
{
func
(
self
*
JSEthereum
)
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
string
)
otto
.
Value
{
r
,
err
:=
self
.
JSXEth
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
r
,
err
:=
self
.
JSXEth
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -103,18 +105,6 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
...
@@ -103,18 +105,6 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
return
self
.
toVal
(
r
)
return
self
.
toVal
(
r
)
}
}
func
(
self
*
JSEthereum
)
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
string
)
otto
.
Value
{
r
,
err
:=
self
.
JSXEth
.
Transact
(
key
,
""
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
UndefinedValue
()
}
return
self
.
toVal
(
r
)
}
func
(
self
*
JSEthereum
)
toVal
(
v
interface
{})
otto
.
Value
{
func
(
self
*
JSEthereum
)
toVal
(
v
interface
{})
otto
.
Value
{
result
,
err
:=
self
.
vm
.
ToValue
(
v
)
result
,
err
:=
self
.
vm
.
ToValue
(
v
)
...
...
vm/analysis.go
View file @
16f417f5
...
@@ -12,7 +12,6 @@ func analyseJumpDests(code []byte) (dests *set.Set) {
...
@@ -12,7 +12,6 @@ func analyseJumpDests(code []byte) (dests *set.Set) {
a
:=
uint64
(
op
)
-
uint64
(
PUSH1
)
+
1
a
:=
uint64
(
op
)
-
uint64
(
PUSH1
)
+
1
pc
+=
a
pc
+=
a
//lp = true
case
JUMPDEST
:
case
JUMPDEST
:
dests
.
Add
(
pc
)
dests
.
Add
(
pc
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment