mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Local Swarm working again after merge.
This commit is contained in:
parent
b3432c1cd3
commit
61ee8c232d
4 changed files with 12 additions and 9 deletions
|
|
@ -5,7 +5,7 @@ INDEX='index.html'
|
||||||
bzzroot="$1"
|
bzzroot="$1"
|
||||||
[ "_$1" = _ ] && bzzroot=.
|
[ "_$1" = _ ] && bzzroot=.
|
||||||
|
|
||||||
delimiter='[{'
|
delimiter='{"entries":[{'
|
||||||
|
|
||||||
pushd "$bzzroot" > /dev/null
|
pushd "$bzzroot" > /dev/null
|
||||||
|
|
||||||
|
|
@ -16,11 +16,11 @@ name=`echo "$path" | cut -c2-`
|
||||||
echo -n "$delimiter"
|
echo -n "$delimiter"
|
||||||
hash=`wget -q -O- --post-file="$path" http://localhost:8500/raw`
|
hash=`wget -q -O- --post-file="$path" http://localhost:8500/raw`
|
||||||
mime=`mimetype -b "$path"`
|
mime=`mimetype -b "$path"`
|
||||||
echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"content_type\":\"$mime\""
|
echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"contentType\":\"$mime\""
|
||||||
delimiter='},{'
|
delimiter='},{'
|
||||||
|
|
||||||
done
|
done
|
||||||
echo -n '}]') | wget -q -O- --post-data=`cat` http://localhost:8500/raw
|
echo -n '}]}') | wget -q -O- --post-data=`cat` http://localhost:8500/raw
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ func (self *DPA) Start() {
|
||||||
self.quitC = make(chan bool)
|
self.quitC = make(chan bool)
|
||||||
self.storeLoop()
|
self.storeLoop()
|
||||||
self.retrieveLoop()
|
self.retrieveLoop()
|
||||||
|
dpaLogger.Infof("Swarm started.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *DPA) Stop() {
|
func (self *DPA) Stop() {
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func handler(w http.ResponseWriter, r *http.Request, dpa *DPA) {
|
||||||
if int64(size) < manifestReader.Size() {
|
if int64(size) < manifestReader.Size() {
|
||||||
dpaLogger.Debugf("Swarm: Manifest %s not found.", name)
|
dpaLogger.Debugf("Swarm: Manifest %s not found.", name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
http.Error(w, "Manifest retrieval cut short: "+string(size)+"<"+string(manifestReader.Size()),
|
http.Error(w, "Manifest retrieval cut short: "+string(size)+"<"+string(manifestReader.Size()),
|
||||||
http.StatusNotFound)
|
http.StatusNotFound)
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
|
|
@ -215,5 +215,6 @@ func StartHttpServer(dpa *DPA) {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
handler(w, r, dpa)
|
handler(w, r, dpa)
|
||||||
})
|
})
|
||||||
http.ListenAndServe(port, nil)
|
go http.ListenAndServe(port, nil)
|
||||||
|
dpaLogger.Infof("Swarm HTTP proxy started.")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ type Ethereum struct {
|
||||||
func New(config *Config) (*Ethereum, error) {
|
func New(config *Config) (*Ethereum, error) {
|
||||||
// Boostrap database
|
// Boostrap database
|
||||||
logger := ethlogger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
|
logger := ethlogger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
|
||||||
db, err := ethdb.NewLDBDatabase("blockchain")
|
db, err := ethdb.NewLDBDatabase(config.DataDir + "/blockchain")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
d, _ := db.Get([]byte("ProtocolVersion"))
|
d, _ := db.Get([]byte("ProtocolVersion"))
|
||||||
protov := ethutil.NewValue(d).Uint()
|
protov := ethutil.NewValue(d).Uint()
|
||||||
if protov != ProtocolVersion && protov != 0 {
|
if protov != ProtocolVersion && protov != 0 {
|
||||||
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, ethutil.Config.ExecPath+"/database")
|
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, config.DataDir+"/blockchain")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new keymanager
|
// Create new keymanager
|
||||||
|
|
@ -164,8 +164,6 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
Chunker: chunker,
|
Chunker: chunker,
|
||||||
ChunkStore: netStore,
|
ChunkStore: netStore,
|
||||||
}
|
}
|
||||||
eth.dpa.Start()
|
|
||||||
go bzz.StartHttpServer(eth.dpa)
|
|
||||||
|
|
||||||
netprv := config.NodeKey
|
netprv := config.NodeKey
|
||||||
if netprv == nil {
|
if netprv == nil {
|
||||||
|
|
@ -276,6 +274,9 @@ func (s *Ethereum) Start(p string, pull string) error {
|
||||||
s.whisper.Start()
|
s.whisper.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.dpa.Start()
|
||||||
|
bzz.StartHttpServer(s.dpa)
|
||||||
|
|
||||||
// broadcast transactions
|
// broadcast transactions
|
||||||
s.txSub = s.eventMux.Subscribe(core.TxPreEvent{})
|
s.txSub = s.eventMux.Subscribe(core.TxPreEvent{})
|
||||||
go s.txBroadcastLoop()
|
go s.txBroadcastLoop()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue