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
4a439c23
Unverified
Commit
4a439c23
authored
Nov 14, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mobile: port wrappers to EIP155 and EIP158 fork
parent
4c16c825
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
48 deletions
+58
-48
bootnodes.go
cmd/utils/bootnodes.go
+0
-20
bind.go
mobile/bind.go
+2
-2
geth.go
mobile/geth.go
+9
-7
params.go
mobile/params.go
+22
-16
types.go
mobile/types.go
+3
-3
config.go
params/config.go
+22
-0
No files found.
cmd/utils/bootnodes.go
View file @
4a439c23
...
...
@@ -17,10 +17,8 @@
package
utils
import
(
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/params"
)
// MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on
...
...
@@ -52,21 +50,3 @@ var DiscoveryV5Bootnodes = []*discv5.Node{
discv5
.
MustParseNode
(
"enode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30308"
),
discv5
.
MustParseNode
(
"enode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30309"
),
}
// MainnetChainConfig is the chain parameters to run a node on the main network.
var
MainnetChainConfig
=
&
core
.
ChainConfig
{
HomesteadBlock
:
params
.
MainNetHomesteadBlock
,
DAOForkBlock
:
params
.
MainNetDAOForkBlock
,
DAOForkSupport
:
true
,
HomesteadGasRepriceBlock
:
params
.
MainNetHomesteadGasRepriceBlock
,
HomesteadGasRepriceHash
:
params
.
MainNetHomesteadGasRepriceHash
,
}
// TestnetChainConfig is the chain parameters to run a node on the test network.
var
TestnetChainConfig
=
&
core
.
ChainConfig
{
HomesteadBlock
:
params
.
TestNetHomesteadBlock
,
DAOForkBlock
:
params
.
TestNetDAOForkBlock
,
DAOForkSupport
:
false
,
HomesteadGasRepriceBlock
:
params
.
TestNetHomesteadGasRepriceBlock
,
HomesteadGasRepriceHash
:
params
.
TestNetHomesteadGasRepriceHash
,
}
mobile/bind.go
View file @
4a439c23
...
...
@@ -39,7 +39,7 @@ type signer struct {
}
func
(
s
*
signer
)
Sign
(
addr
*
Address
,
tx
*
Transaction
)
(
*
Transaction
,
error
)
{
sig
,
err
:=
s
.
sign
(
addr
.
address
,
tx
.
tx
)
sig
,
err
:=
s
.
sign
(
types
.
HomesteadSigner
{},
addr
.
address
,
tx
.
tx
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -89,7 +89,7 @@ func (opts *TransactOpts) GetGasLimit() int64 { return opts.opts.GasLimit.Int6
func
(
opts
*
TransactOpts
)
SetFrom
(
from
*
Address
)
{
opts
.
opts
.
From
=
from
.
address
}
func
(
opts
*
TransactOpts
)
SetNonce
(
nonce
int64
)
{
opts
.
opts
.
Nonce
=
big
.
NewInt
(
nonce
)
}
func
(
opts
*
TransactOpts
)
SetSigner
(
s
Signer
)
{
opts
.
opts
.
Signer
=
func
(
addr
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
opts
.
opts
.
Signer
=
func
(
signer
types
.
Signer
,
addr
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
sig
,
err
:=
s
.
Sign
(
&
Address
{
addr
},
&
Transaction
{
tx
})
if
err
!=
nil
{
return
nil
,
err
...
...
mobile/geth.go
View file @
4a439c23
...
...
@@ -25,7 +25,6 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethclient"
...
...
@@ -33,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/whisper/whisperv2"
)
...
...
@@ -129,12 +129,14 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) {
// Register the Ethereum protocol if requested
if
config
.
EthereumEnabled
{
ethConf
:=
&
eth
.
Config
{
ChainConfig
:
&
core
.
ChainConfig
{
HomesteadBlock
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
HomesteadBlock
),
DAOForkBlock
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
DAOForkBlock
),
DAOForkSupport
:
config
.
EthereumChainConfig
.
DAOForkSupport
,
HomesteadGasRepriceBlock
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
HomesteadGasRepriceBlock
),
HomesteadGasRepriceHash
:
config
.
EthereumChainConfig
.
HomesteadGasRepriceHash
.
hash
,
ChainConfig
:
&
params
.
ChainConfig
{
HomesteadBlock
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
HomesteadBlock
),
DAOForkBlock
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
DAOForkBlock
),
DAOForkSupport
:
config
.
EthereumChainConfig
.
DAOForkSupport
,
EIP150Block
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
EIP150Block
),
EIP150Hash
:
config
.
EthereumChainConfig
.
EIP150Hash
.
hash
,
EIP155Block
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
EIP155Block
),
EIP158Block
:
big
.
NewInt
(
config
.
EthereumChainConfig
.
EIP158Block
),
},
Genesis
:
config
.
EthereumGenesis
,
LightMode
:
true
,
...
...
mobile/
core
.go
→
mobile/
params
.go
View file @
4a439c23
...
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// Contains all the wrappers from the
core
package.
// Contains all the wrappers from the
params
package.
package
geth
...
...
@@ -26,11 +26,13 @@ import (
// MainnetChainConfig returns the chain configurations for the main Ethereum network.
func
MainnetChainConfig
()
*
ChainConfig
{
return
&
ChainConfig
{
HomesteadBlock
:
params
.
MainNetHomesteadBlock
.
Int64
(),
DAOForkBlock
:
params
.
MainNetDAOForkBlock
.
Int64
(),
DAOForkSupport
:
true
,
HomesteadGasRepriceBlock
:
params
.
MainNetHomesteadGasRepriceBlock
.
Int64
(),
HomesteadGasRepriceHash
:
Hash
{
params
.
MainNetHomesteadGasRepriceHash
},
HomesteadBlock
:
params
.
MainNetHomesteadBlock
.
Int64
(),
DAOForkBlock
:
params
.
MainNetDAOForkBlock
.
Int64
(),
DAOForkSupport
:
true
,
EIP150Block
:
params
.
MainNetHomesteadGasRepriceBlock
.
Int64
(),
EIP150Hash
:
Hash
{
params
.
MainNetHomesteadGasRepriceHash
},
EIP155Block
:
params
.
MainNetSpuriousDragon
.
Int64
(),
EIP158Block
:
params
.
MainNetSpuriousDragon
.
Int64
(),
}
}
...
...
@@ -43,11 +45,13 @@ func MainnetGenesis() string {
// TestnetChainConfig returns the chain configurations for the Ethereum test network.
func
TestnetChainConfig
()
*
ChainConfig
{
return
&
ChainConfig
{
HomesteadBlock
:
params
.
TestNetHomesteadBlock
.
Int64
(),
DAOForkBlock
:
0
,
DAOForkSupport
:
false
,
HomesteadGasRepriceBlock
:
params
.
TestNetHomesteadGasRepriceBlock
.
Int64
(),
HomesteadGasRepriceHash
:
Hash
{
params
.
TestNetHomesteadGasRepriceHash
},
HomesteadBlock
:
params
.
TestNetHomesteadBlock
.
Int64
(),
DAOForkBlock
:
0
,
DAOForkSupport
:
false
,
EIP150Block
:
params
.
TestNetHomesteadGasRepriceBlock
.
Int64
(),
EIP150Hash
:
Hash
{
params
.
TestNetHomesteadGasRepriceHash
},
EIP155Block
:
params
.
TestNetSpuriousDragon
.
Int64
(),
EIP158Block
:
params
.
TestNetSpuriousDragon
.
Int64
(),
}
}
...
...
@@ -58,11 +62,13 @@ func TestnetGenesis() string {
// ChainConfig is the core config which determines the blockchain settings.
type
ChainConfig
struct
{
HomesteadBlock
int64
// Homestead switch block
DAOForkBlock
int64
// TheDAO hard-fork switch block
DAOForkSupport
bool
// Whether the nodes supports or opposes the DAO hard-fork
HomesteadGasRepriceBlock
int64
// Homestead gas reprice switch block
HomesteadGasRepriceHash
Hash
// Homestead gas reprice switch block hash
HomesteadBlock
int64
// Homestead switch block
DAOForkBlock
int64
// TheDAO hard-fork switch block
DAOForkSupport
bool
// Whether the nodes supports or opposes the DAO hard-fork
EIP150Block
int64
// Homestead gas reprice switch block
EIP150Hash
Hash
// Homestead gas reprice switch block hash
EIP155Block
int64
// Replay protection switch block
EIP158Block
int64
// Empty account pruning switch block
}
// NewChainConfig creates a new chain configuration that transitions immediately
...
...
mobile/types.go
View file @
4a439c23
...
...
@@ -139,11 +139,11 @@ func (tx *Transaction) GetValue() *BigInt { return &BigInt{tx.tx.Value()} }
func
(
tx
*
Transaction
)
GetNonce
()
int64
{
return
int64
(
tx
.
tx
.
Nonce
())
}
func
(
tx
*
Transaction
)
GetHash
()
*
Hash
{
return
&
Hash
{
tx
.
tx
.
Hash
()}
}
func
(
tx
*
Transaction
)
GetSigHash
()
*
Hash
{
return
&
Hash
{
tx
.
tx
.
SigHash
()}
}
func
(
tx
*
Transaction
)
GetSigHash
()
*
Hash
{
return
&
Hash
{
tx
.
tx
.
SigHash
(
types
.
HomesteadSigner
{}
)}
}
func
(
tx
*
Transaction
)
GetCost
()
*
BigInt
{
return
&
BigInt
{
tx
.
tx
.
Cost
()}
}
func
(
tx
*
Transaction
)
GetFrom
()
(
*
Address
,
error
)
{
from
,
err
:=
t
x
.
tx
.
From
(
)
from
,
err
:=
t
ypes
.
Sender
(
types
.
HomesteadSigner
{},
tx
.
tx
)
return
&
Address
{
from
},
err
}
...
...
@@ -155,7 +155,7 @@ func (tx *Transaction) GetTo() *Address {
}
func
(
tx
*
Transaction
)
WithSignature
(
sig
[]
byte
)
(
*
Transaction
,
error
)
{
t
,
err
:=
tx
.
tx
.
WithSignature
(
sig
)
t
,
err
:=
tx
.
tx
.
WithSignature
(
types
.
HomesteadSigner
{},
sig
)
return
&
Transaction
{
t
},
err
}
...
...
params/config.go
View file @
4a439c23
...
...
@@ -22,6 +22,28 @@ import (
"github.com/ethereum/go-ethereum/common"
)
// MainnetChainConfig is the chain parameters to run a node on the main network.
var
MainnetChainConfig
=
&
ChainConfig
{
HomesteadBlock
:
MainNetHomesteadBlock
,
DAOForkBlock
:
MainNetDAOForkBlock
,
DAOForkSupport
:
true
,
EIP150Block
:
MainNetHomesteadGasRepriceBlock
,
EIP150Hash
:
MainNetHomesteadGasRepriceHash
,
EIP155Block
:
MainNetSpuriousDragon
,
EIP158Block
:
MainNetSpuriousDragon
,
}
// TestnetChainConfig is the chain parameters to run a node on the test network.
var
TestnetChainConfig
=
&
ChainConfig
{
HomesteadBlock
:
TestNetHomesteadBlock
,
DAOForkBlock
:
TestNetDAOForkBlock
,
DAOForkSupport
:
false
,
EIP150Block
:
TestNetHomesteadGasRepriceBlock
,
EIP150Hash
:
TestNetHomesteadGasRepriceHash
,
EIP155Block
:
TestNetSpuriousDragon
,
EIP158Block
:
TestNetSpuriousDragon
,
}
// ChainConfig is the core config which determines the blockchain settings.
//
// ChainConfig is stored in the database on a per block basis. This means
...
...
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