aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go22
-rw-r--r--eth/downloader/downloader_test.go2
-rw-r--r--eth/handler.go4
-rw-r--r--eth/peer.go10
4 files changed, 29 insertions, 9 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 519a4c410..69504fd94 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"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/types"
"github.com/ethereum/go-ethereum/core/vm"
@@ -79,6 +80,7 @@ type Config struct {
GasPrice *big.Int
MinerThreads int
AccountManager *accounts.Manager
+ SolcPath string
// NewDB is used to create databases.
// If nil, the default is to create leveldb databases on disk.
@@ -181,6 +183,8 @@ type Ethereum struct {
pow *ethash.Ethash
protocolManager *ProtocolManager
downloader *downloader.Downloader
+ SolcPath string
+ solc *compiler.Solidity
net *p2p.Server
eventMux *event.TypeMux
@@ -209,7 +213,7 @@ func New(config *Config) (*Ethereum, error) {
// Let the database take 3/4 of the max open files (TODO figure out a way to get the actual limit of the open files)
const dbCount = 3
- ethdb.OpenFileLimit = 256 / (dbCount + 1)
+ ethdb.OpenFileLimit = 128 / (dbCount + 1)
newdb := config.NewDB
if newdb == nil {
@@ -264,6 +268,7 @@ func New(config *Config) (*Ethereum, error) {
netVersionId: config.NetworkId,
NatSpec: config.NatSpec,
MinerThreads: config.MinerThreads,
+ SolcPath: config.SolcPath,
}
eth.pow = ethash.New()
@@ -571,3 +576,18 @@ func saveBlockchainVersion(db common.Database, bcVersion int) {
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()
+}
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index 6299ea162..8b541d8b7 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -388,7 +388,7 @@ func TestRepeatingHashAttack(t *testing.T) {
// Make sure that syncing returns and does so with a failure
select {
- case <-time.After(100 * time.Millisecond):
+ case <-time.After(time.Second):
t.Fatalf("synchronisation blocked")
case err := <-errc:
if err == nil {
diff --git a/eth/handler.go b/eth/handler.go
index 63b1d50f6..9117a70de 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -350,7 +350,7 @@ func (pm *ProtocolManager) verifyTd(peer *peer, request newBlockMsgData) error {
// sqrt(peers) to determine the amount of peers we broadcast to.
func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) {
// Broadcast block to a batch of peers not knowing about it
- peers := pm.peers.BlockLackingPeers(hash)
+ peers := pm.peers.PeersWithoutBlock(hash)
peers = peers[:int(math.Sqrt(float64(len(peers))))]
for _, peer := range peers {
peer.sendNewBlock(block)
@@ -363,7 +363,7 @@ func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block)
// sqrt(peers) to determine the amount of peers we broadcast to.
func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction) {
// Broadcast transaction to a batch of peers not knowing about it
- peers := pm.peers.TxLackingPeers(hash)
+ peers := pm.peers.PeersWithoutTx(hash)
//FIXME include this again: peers = peers[:int(math.Sqrt(float64(len(peers))))]
for _, peer := range peers {
peer.sendTransaction(tx)
diff --git a/eth/peer.go b/eth/peer.go
index 1ef032d38..bb6a20349 100644
--- a/eth/peer.go
+++ b/eth/peer.go
@@ -214,9 +214,9 @@ func (ps *peerSet) Len() int {
return len(ps.peers)
}
-// BlockLackingPeers retrieves a list of peers that do not have a given block
-// in their set of known hashes.
-func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer {
+// PeersWithoutBlock retrieves a list of peers that do not have a given block in
+// their set of known hashes.
+func (ps *peerSet) PeersWithoutBlock(hash common.Hash) []*peer {
ps.lock.RLock()
defer ps.lock.RUnlock()
@@ -229,9 +229,9 @@ func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer {
return list
}
-// TxLackingPeers retrieves a list of peers that do not have a given transaction
+// PeersWithoutTx retrieves a list of peers that do not have a given transaction
// in their set of known hashes.
-func (ps *peerSet) TxLackingPeers(hash common.Hash) []*peer {
+func (ps *peerSet) PeersWithoutTx(hash common.Hash) []*peer {
ps.lock.RLock()
defer ps.lock.RUnlock()