mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Re-introduced Swarm and Swarm http proxy into geth.
This commit is contained in:
parent
7aa3ff6ae5
commit
9db8b3df1e
4 changed files with 25 additions and 2 deletions
|
|
@ -232,7 +232,7 @@ func (s *dbStore) collectGarbage(ratio float32) {
|
||||||
cutidx := gcListSelect(s.gcArray, 0, gcnt-1, int(float32(gcnt)*ratio))
|
cutidx := gcListSelect(s.gcArray, 0, gcnt-1, int(float32(gcnt)*ratio))
|
||||||
cutval := s.gcArray[cutidx].value
|
cutval := s.gcArray[cutidx].value
|
||||||
|
|
||||||
fmt.Print(gcnt, " ", s.entryCnt, " ")
|
// fmt.Print(gcnt, " ", s.entryCnt, " ")
|
||||||
|
|
||||||
// actual gc
|
// actual gc
|
||||||
for i := 0; i < gcnt; i++ {
|
for i := 0; i < gcnt; i++ {
|
||||||
|
|
@ -246,7 +246,7 @@ func (s *dbStore) collectGarbage(ratio float32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(s.entryCnt)
|
// fmt.Println(s.entryCnt)
|
||||||
|
|
||||||
s.db.Put(keyGCPos, s.gcPos)
|
s.db.Put(keyGCPos, s.gcPos)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
|
||||||
utils.RPCListenAddrFlag,
|
utils.RPCListenAddrFlag,
|
||||||
utils.RPCPortFlag,
|
utils.RPCPortFlag,
|
||||||
utils.WhisperEnabledFlag,
|
utils.WhisperEnabledFlag,
|
||||||
|
utils.SwarmEnabledFlag,
|
||||||
utils.VMDebugFlag,
|
utils.VMDebugFlag,
|
||||||
utils.ProtocolVersionFlag,
|
utils.ProtocolVersionFlag,
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,10 @@ var (
|
||||||
Name: "shh",
|
Name: "shh",
|
||||||
Usage: "Enable whisper",
|
Usage: "Enable whisper",
|
||||||
}
|
}
|
||||||
|
SwarmEnabledFlag = cli.BoolFlag{
|
||||||
|
Name: "bzz",
|
||||||
|
Usage: "Enable swarm",
|
||||||
|
}
|
||||||
// ATM the url is left to the user and deployment to
|
// ATM the url is left to the user and deployment to
|
||||||
JSpathFlag = cli.StringFlag{
|
JSpathFlag = cli.StringFlag{
|
||||||
Name: "jspath",
|
Name: "jspath",
|
||||||
|
|
@ -309,6 +313,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
|
||||||
NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
|
NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
|
||||||
NodeKey: GetNodeKey(ctx),
|
NodeKey: GetNodeKey(ctx),
|
||||||
Shh: ctx.GlobalBool(WhisperEnabledFlag.Name),
|
Shh: ctx.GlobalBool(WhisperEnabledFlag.Name),
|
||||||
|
Bzz: ctx.GlobalBool(SwarmEnabledFlag.Name),
|
||||||
Dial: true,
|
Dial: true,
|
||||||
BootNodes: ctx.GlobalString(BootnodesFlag.Name),
|
BootNodes: ctx.GlobalString(BootnodesFlag.Name),
|
||||||
GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
|
GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
|
||||||
|
|
|
||||||
|
|
@ -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/bzz"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"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"
|
||||||
|
|
@ -74,6 +75,7 @@ type Config struct {
|
||||||
|
|
||||||
NAT nat.Interface
|
NAT nat.Interface
|
||||||
Shh bool
|
Shh bool
|
||||||
|
Bzz bool
|
||||||
Dial bool
|
Dial bool
|
||||||
|
|
||||||
Etherbase string
|
Etherbase string
|
||||||
|
|
@ -280,7 +282,22 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
protocols := []p2p.Protocol{eth.protocolManager.SubProtocol}
|
protocols := []p2p.Protocol{eth.protocolManager.SubProtocol}
|
||||||
|
|
||||||
|
if config.Bzz {
|
||||||
|
netStore := bzz.NewNetStore(config.DataDir + "/bzz")
|
||||||
|
chunker := &bzz.TreeChunker{}
|
||||||
|
chunker.Init()
|
||||||
|
dpa := &bzz.DPA{
|
||||||
|
Chunker: chunker,
|
||||||
|
ChunkStore: netStore,
|
||||||
|
}
|
||||||
|
dpa.Start()
|
||||||
|
protocols = append(protocols, bzz.BzzProtocol(netStore))
|
||||||
|
go bzz.StartHttpServer(dpa)
|
||||||
|
}
|
||||||
|
|
||||||
if config.Shh {
|
if config.Shh {
|
||||||
protocols = append(protocols, eth.whisper.Protocol())
|
protocols = append(protocols, eth.whisper.Protocol())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue