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
31811365
Commit
31811365
authored
Apr 24, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #800 from obscuren/ethereum_js_update
Ethereum js update
parents
b6ec1c72
dc62fb2e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
8 additions
and
13 deletions
+8
-13
.gitignore
.gitignore
+0
-2
.gitmodules
.gitmodules
+1
-1
js.go
cmd/geth/js.go
+1
-1
coin.html
cmd/mist/assets/examples/coin.html
+1
-2
ethereum.js
cmd/mist/assets/ext/ethereum.js
+1
-1
handler.go
eth/handler.go
+1
-5
ethereum_js.go
jsre/ethereum_js.go
+3
-1
No files found.
.gitignore
View file @
31811365
...
@@ -23,8 +23,6 @@ Godeps/_workspace/bin
...
@@ -23,8 +23,6 @@ Godeps/_workspace/bin
.project
.project
.settings
.settings
mist
cmd/mist/mist
deploy/osx/Mist.app
deploy/osx/Mist.app
deploy/osx/Mist\ Installer.dmg
deploy/osx/Mist\ Installer.dmg
...
...
.gitmodules
View file @
31811365
[submodule "cmd/mist/assets/ext/ethereum.js"]
[submodule "cmd/mist/assets/ext/ethereum.js"]
path = cmd/mist/assets/ext/ethereum.js
path = cmd/mist/assets/ext/ethereum.js
url = https://github.com/ethereum/
ethereum
.js
url = https://github.com/ethereum/
web3
.js
cmd/geth/js.go
View file @
31811365
...
@@ -118,7 +118,7 @@ func (js *jsre) apiBindings() {
...
@@ -118,7 +118,7 @@ func (js *jsre) apiBindings() {
utils
.
Fatalf
(
"Error loading ethereum.js: %v"
,
err
)
utils
.
Fatalf
(
"Error loading ethereum.js: %v"
,
err
)
}
}
_
,
err
=
js
.
re
.
Eval
(
"var web3 = require('
ethereum.js
');"
)
_
,
err
=
js
.
re
.
Eval
(
"var web3 = require('
web3
');"
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"Error requiring web3: %v"
,
err
)
utils
.
Fatalf
(
"Error requiring web3: %v"
,
err
)
}
}
...
...
cmd/mist/assets/examples/coin.html
View file @
31811365
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<title>
JevCoin
</title>
<title>
JevCoin
</title>
<head>
<head>
<script
type=
"text/javascript"
src=
"../ext/bignumber.min.js"
></script>
<script
type=
"text/javascript"
src=
"../ext/bignumber.min.js"
></script>
<script
type=
"text/javascript"
src=
"../ext/ethereum.js/dist/
ethereum
-light.min.js"
></script>
<script
type=
"text/javascript"
src=
"../ext/ethereum.js/dist/
web3
-light.min.js"
></script>
</head>
</head>
<body>
<body>
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
</body>
</body>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
web3
=
require
(
'ethereum.js'
);
var
eth
=
web3
.
eth
;
var
eth
=
web3
.
eth
;
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
));
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
));
...
...
ethereum.js
@
f8a43edd
Subproject commit
c80ede50c3b60a482f1ec76038325ec52f5e73b0
Subproject commit
f8a43eddfb450d0e0ba1669a6916babe0ea43642
eth/handler.go
View file @
31811365
...
@@ -276,7 +276,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
...
@@ -276,7 +276,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
return
errResp
(
ErrDecode
,
"block validation %v: %v"
,
msg
,
err
)
return
errResp
(
ErrDecode
,
"block validation %v: %v"
,
msg
,
err
)
}
}
hash
:=
request
.
Block
.
Hash
()
hash
:=
request
.
Block
.
Hash
()
// Add the block hash as a known hash to the peer. This will later be used to det
i
rmine
// Add the block hash as a known hash to the peer. This will later be used to det
e
rmine
// who should receive this.
// who should receive this.
p
.
blockHashes
.
Add
(
hash
)
p
.
blockHashes
.
Add
(
hash
)
...
@@ -296,7 +296,6 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
...
@@ -296,7 +296,6 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
if
self
.
chainman
.
HasBlock
(
hash
)
{
if
self
.
chainman
.
HasBlock
(
hash
)
{
break
break
}
}
/* XXX unsure about this */
if
self
.
chainman
.
Td
()
.
Cmp
(
request
.
TD
)
>
0
&&
new
(
big
.
Int
)
.
Add
(
request
.
Block
.
Number
(),
big
.
NewInt
(
7
))
.
Cmp
(
self
.
chainman
.
CurrentBlock
()
.
Number
())
<
0
{
if
self
.
chainman
.
Td
()
.
Cmp
(
request
.
TD
)
>
0
&&
new
(
big
.
Int
)
.
Add
(
request
.
Block
.
Number
(),
big
.
NewInt
(
7
))
.
Cmp
(
self
.
chainman
.
CurrentBlock
()
.
Number
())
<
0
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"[%s] dropped block %v due to low TD %v
\n
"
,
p
.
id
,
request
.
Block
.
Number
(),
request
.
TD
)
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"[%s] dropped block %v due to low TD %v
\n
"
,
p
.
id
,
request
.
Block
.
Number
(),
request
.
TD
)
break
break
...
@@ -305,14 +304,12 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
...
@@ -305,14 +304,12 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
// Attempt to insert the newly received by checking if the parent exists.
// Attempt to insert the newly received by checking if the parent exists.
// if the parent exists we process the block and propagate to our peers
// if the parent exists we process the block and propagate to our peers
// if the parent does not exists we delegate to the downloader.
// if the parent does not exists we delegate to the downloader.
// NOTE we can reduce chatter by dropping blocks with Td < currentTd
if
self
.
chainman
.
HasBlock
(
request
.
Block
.
ParentHash
())
{
if
self
.
chainman
.
HasBlock
(
request
.
Block
.
ParentHash
())
{
if
err
:=
self
.
chainman
.
InsertChain
(
types
.
Blocks
{
request
.
Block
});
err
!=
nil
{
if
err
:=
self
.
chainman
.
InsertChain
(
types
.
Blocks
{
request
.
Block
});
err
!=
nil
{
// handle error
// handle error
return
nil
return
nil
}
}
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
//fmt.Println(request.Block.Hash().Hex(), "our calculated TD =", request.Block.Td, "their TD =", request.TD)
}
else
{
}
else
{
// adding blocks is synchronous
// adding blocks is synchronous
go
func
()
{
go
func
()
{
...
@@ -322,7 +319,6 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
...
@@ -322,7 +319,6 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
return
return
}
}
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
//fmt.Println(request.Block.Hash().Hex(), "our calculated TD =", request.Block.Td, "their TD =", request.TD)
}()
}()
}
}
default
:
default
:
...
...
jsre/ethereum_js.go
View file @
31811365
This diff is collapsed.
Click to expand it.
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