mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 12:16:44 +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"
|
||||
[ "_$1" = _ ] && bzzroot=.
|
||||
|
||||
delimiter='[{'
|
||||
delimiter='{"entries":[{'
|
||||
|
||||
pushd "$bzzroot" > /dev/null
|
||||
|
||||
|
|
@ -16,11 +16,11 @@ name=`echo "$path" | cut -c2-`
|
|||
echo -n "$delimiter"
|
||||
hash=`wget -q -O- --post-file="$path" http://localhost:8500/raw`
|
||||
mime=`mimetype -b "$path"`
|
||||
echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"content_type\":\"$mime\""
|
||||
echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"contentType\":\"$mime\""
|
||||
delimiter='},{'
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ func (self *DPA) Start() {
|
|||
self.quitC = make(chan bool)
|
||||
self.storeLoop()
|
||||
self.retrieveLoop()
|
||||
dpaLogger.Infof("Swarm started.")
|
||||
}
|
||||
|
||||
func (self *DPA) Stop() {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ func handler(w http.ResponseWriter, r *http.Request, dpa *DPA) {
|
|||
if int64(size) < manifestReader.Size() {
|
||||
dpaLogger.Debugf("Swarm: Manifest %s not found.", name)
|
||||
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)
|
||||
} else {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
|
|
@ -215,5 +215,6 @@ func StartHttpServer(dpa *DPA) {
|
|||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
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) {
|
||||
// Boostrap database
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ func New(config *Config) (*Ethereum, error) {
|
|||
d, _ := db.Get([]byte("ProtocolVersion"))
|
||||
protov := ethutil.NewValue(d).Uint()
|
||||
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
|
||||
|
|
@ -164,8 +164,6 @@ func New(config *Config) (*Ethereum, error) {
|
|||
Chunker: chunker,
|
||||
ChunkStore: netStore,
|
||||
}
|
||||
eth.dpa.Start()
|
||||
go bzz.StartHttpServer(eth.dpa)
|
||||
|
||||
netprv := config.NodeKey
|
||||
if netprv == nil {
|
||||
|
|
@ -276,6 +274,9 @@ func (s *Ethereum) Start(p string, pull string) error {
|
|||
s.whisper.Start()
|
||||
}
|
||||
|
||||
s.dpa.Start()
|
||||
bzz.StartHttpServer(s.dpa)
|
||||
|
||||
// broadcast transactions
|
||||
s.txSub = s.eventMux.Subscribe(core.TxPreEvent{})
|
||||
go s.txBroadcastLoop()
|
||||
|
|
|
|||
Loading…
Reference in a new issue