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
d7eca7bc
Commit
d7eca7bc
authored
Feb 18, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rlp update
parent
68028f49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
27 deletions
+21
-27
ethereum.go
ethereum.go
+20
-17
encoding.go
ethutil/encoding.go
+1
-2
rlp.go
ethutil/rlp.go
+0
-8
No files found.
ethereum.go
View file @
d7eca7bc
...
...
@@ -85,7 +85,6 @@ func New(caps Caps, usePnp bool) (*Ethereum, error) {
Nonce
:
nonce
,
serverCaps
:
caps
,
nat
:
nat
,
MaxPeers
:
5
,
}
ethereum
.
TxPool
=
ethchain
.
NewTxPool
()
ethereum
.
TxPool
.
Speaker
=
ethereum
...
...
@@ -114,6 +113,7 @@ func (s *Ethereum) ProcessPeerList(addrs []string) {
}
func
(
s
*
Ethereum
)
ConnectToPeer
(
addr
string
)
error
{
if
s
.
peers
.
Len
()
<
s
.
MaxPeers
{
var
alreadyConnected
bool
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
v
*
list
.
Element
)
{
...
...
@@ -137,6 +137,9 @@ func (s *Ethereum) ConnectToPeer(addr string) error {
s
.
peers
.
PushBack
(
peer
)
log
.
Printf
(
"[SERV] Adding peer %d / %d
\n
"
,
s
.
peers
.
Len
(),
s
.
MaxPeers
)
}
return
nil
}
...
...
ethutil/encoding.go
View file @
d7eca7bc
...
...
@@ -3,7 +3,6 @@ package ethutil
import
(
"bytes"
"encoding/hex"
_
"fmt"
"strings"
)
...
...
@@ -36,7 +35,7 @@ func CompactEncode(hexSlice []int) string {
func
CompactDecode
(
str
string
)
[]
int
{
base
:=
CompactHexDecode
(
str
)
base
=
base
[
:
len
(
base
)
-
1
]
if
base
[
0
]
>=
2
{
// && base[len(base)-1] != 16 {
if
base
[
0
]
>=
2
{
base
=
append
(
base
,
16
)
}
if
base
[
0
]
%
2
==
1
{
...
...
ethutil/rlp.go
View file @
d7eca7bc
...
...
@@ -86,13 +86,6 @@ func DecodeWithReader(reader *bytes.Buffer) interface{} {
// TODO Use a bytes.Buffer instead of a raw byte slice.
// Cleaner code, and use draining instead of seeking the next bytes to read
func
Decode
(
data
[]
byte
,
pos
uint64
)
(
interface
{},
uint64
)
{
/*
if pos > uint64(len(data)-1) {
log.Println(data)
log.Panicf("index out of range %d for data %q, l = %d", pos, data, len(data))
}
*/
var
slice
[]
interface
{}
char
:=
int
(
data
[
pos
])
switch
{
...
...
@@ -131,7 +124,6 @@ func Decode(data []byte, pos uint64) (interface{}, uint64) {
case
char
<=
0xff
:
l
:=
uint64
(
data
[
pos
])
-
0xf7
//b := BigD(data[pos+1 : pos+1+l]).Uint64()
b
:=
ReadVarint
(
bytes
.
NewReader
(
data
[
pos
+
1
:
pos
+
1
+
l
]))
pos
=
pos
+
l
+
1
...
...
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