Skip to content

Commit

Permalink
Moar logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoras committed Feb 1, 2019
1 parent dbb8a22 commit 017383c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,18 @@ func (p2pc *p2pConnection) handleBlock(msg StrIfMap) {
log.Printf("remove: %v", err)
}
}()
log.Println("Getting block", height, "from", dataString)
resp, err := http.Get(dataString)
if err != nil {
log.Println("Error receiving block at", dataString, err)
return
}
defer resp.Body.Close()
written, err := io.Copy(blockFile, resp.Body)
if err != nil {
log.Println("Error saving block:", err)
return
}
if written != fileSize {
log.Println("Error decoding block: sizes don't match:", written, "vs", fileSize)
return
Expand Down

0 comments on commit 017383c

Please sign in to comment.