cmd/swarm/swarm-smoke: added debug output

This commit is contained in:
Fabio Barone 2019-02-14 11:15:57 -05:00
parent d7429b1361
commit 30915726d6

View file

@ -76,15 +76,20 @@ func triggerChunkDebug(testData []byte) error {
// has-chunks // has-chunks
for _, host := range hosts { for _, host := range hosts {
httpHost := fmt.Sprintf("ws://%s:%d", host, 8546) httpHost := fmt.Sprintf("ws://%s:%d", host, 8546)
log.Trace("Calling `Has` on host", "httpHost", httpHost)
rpcClient, err := rpc.Dial(httpHost) rpcClient, err := rpc.Dial(httpHost)
if err != nil { if err != nil {
log.Trace("Error dialing host", "err", err)
return err return err
} }
log.Trace("rpc dial ok")
var hasInfo []api.HasInfo var hasInfo []api.HasInfo
err = rpcClient.Call(&hasInfo, "bzz_has", addrs) err = rpcClient.Call(&hasInfo, "bzz_has", addrs)
if err != nil { if err != nil {
log.Trace("Error calling host", "err", err)
return err return err
} }
log.Trace("rpc call ok")
count := 0 count := 0
for _, info := range hasInfo { for _, info := range hasInfo {
if !info.Has { if !info.Has {
@ -100,6 +105,7 @@ func triggerChunkDebug(testData []byte) error {
} }
func getAllRefs(testData []byte) (storage.AddressCollection, error) { func getAllRefs(testData []byte) (storage.AddressCollection, error) {
log.Trace("Getting all references for given root hash")
datadir, err := ioutil.TempDir("", "chunk-debug") datadir, err := ioutil.TempDir("", "chunk-debug")
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to create temp dir: %v", err) return nil, fmt.Errorf("unable to create temp dir: %v", err)
@ -117,6 +123,7 @@ func getAllRefs(testData []byte) (storage.AddressCollection, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Trace("All references retrieved")
return addrs, err return addrs, err
} }