Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
swarm/network: debug trace code
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed Apr 15, 2019
1 parent acf6431 commit 05f9168
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions swarm/network/stream/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error {
}
}
s.currentBatch = hashes

///// TODO: remove debug code before merge

lenHashes := len(hashes)
if lenHashes%HashSize != 0 {
panic("wtf")
}

for i := 0; i < lenHashes; i += HashSize {
hash := hashes[i : i+HashSize]
log.Trace("offering hash", "ref", fmt.Sprintf("%x", hash), "peer", p.ID(), "stream", s.stream, "len", len(hashes), "from", from, "to", to)
}

//////

msg := &OfferedHashesMsg{
HandoverProof: proof,
Hashes: hashes,
Expand Down
2 changes: 2 additions & 0 deletions swarm/network/stream/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/swarm/chunk"
"github.com/ethereum/go-ethereum/swarm/log"
"github.com/ethereum/go-ethereum/swarm/network/timeouts"
"github.com/ethereum/go-ethereum/swarm/storage"
)
Expand Down Expand Up @@ -128,6 +129,7 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
iterate = false
break
}
log.Trace("syncer add chunk", "ref", fmt.Sprintf("%x", d.Address[:]), "po", s.po, "from", from, "to", to)
batch = append(batch, d.Address[:]...)
// This is the most naive approach to label the chunk as synced
// allowing it to be garbage collected. A proper way requires
Expand Down

0 comments on commit 05f9168

Please sign in to comment.