|
|
@ -14,6 +14,7 @@ import ( |
|
|
|
"github.com/ethereum/ethash" |
|
|
|
"github.com/ethereum/ethash" |
|
|
|
"github.com/ethereum/go-ethereum/accounts" |
|
|
|
"github.com/ethereum/go-ethereum/accounts" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common/compiler" |
|
|
|
"github.com/ethereum/go-ethereum/core" |
|
|
|
"github.com/ethereum/go-ethereum/core" |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/core/vm" |
|
|
|
"github.com/ethereum/go-ethereum/core/vm" |
|
|
@ -79,6 +80,7 @@ type Config struct { |
|
|
|
GasPrice *big.Int |
|
|
|
GasPrice *big.Int |
|
|
|
MinerThreads int |
|
|
|
MinerThreads int |
|
|
|
AccountManager *accounts.Manager |
|
|
|
AccountManager *accounts.Manager |
|
|
|
|
|
|
|
SolcPath string |
|
|
|
|
|
|
|
|
|
|
|
// NewDB is used to create databases.
|
|
|
|
// NewDB is used to create databases.
|
|
|
|
// If nil, the default is to create leveldb databases on disk.
|
|
|
|
// If nil, the default is to create leveldb databases on disk.
|
|
|
@ -181,6 +183,8 @@ type Ethereum struct { |
|
|
|
pow *ethash.Ethash |
|
|
|
pow *ethash.Ethash |
|
|
|
protocolManager *ProtocolManager |
|
|
|
protocolManager *ProtocolManager |
|
|
|
downloader *downloader.Downloader |
|
|
|
downloader *downloader.Downloader |
|
|
|
|
|
|
|
SolcPath string |
|
|
|
|
|
|
|
solc *compiler.Solidity |
|
|
|
|
|
|
|
|
|
|
|
net *p2p.Server |
|
|
|
net *p2p.Server |
|
|
|
eventMux *event.TypeMux |
|
|
|
eventMux *event.TypeMux |
|
|
@ -264,6 +268,7 @@ func New(config *Config) (*Ethereum, error) { |
|
|
|
netVersionId: config.NetworkId, |
|
|
|
netVersionId: config.NetworkId, |
|
|
|
NatSpec: config.NatSpec, |
|
|
|
NatSpec: config.NatSpec, |
|
|
|
MinerThreads: config.MinerThreads, |
|
|
|
MinerThreads: config.MinerThreads, |
|
|
|
|
|
|
|
SolcPath: config.SolcPath, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
eth.pow = ethash.New() |
|
|
|
eth.pow = ethash.New() |
|
|
@ -571,3 +576,18 @@ func saveBlockchainVersion(db common.Database, bcVersion int) { |
|
|
|
db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes()) |
|
|
|
db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (self *Ethereum) Solc() (*compiler.Solidity, error) { |
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
|
|
if self.solc == nil { |
|
|
|
|
|
|
|
self.solc, err = compiler.New(self.SolcPath) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return self.solc, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set in js console via admin interface or wrapper from cli flags
|
|
|
|
|
|
|
|
func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error) { |
|
|
|
|
|
|
|
self.SolcPath = solcPath |
|
|
|
|
|
|
|
self.solc = nil |
|
|
|
|
|
|
|
return self.Solc() |
|
|
|
|
|
|
|
} |
|
|
|