swarm/network: HandoverProof should not be nil

This commit is contained in:
Balint Gabor 2018-01-15 18:33:24 +01:00
parent 40cfae13ef
commit d075df7159
2 changed files with 16 additions and 11 deletions

View file

@ -86,7 +86,7 @@ type OfferedHashesMsg struct {
Key []byte // subtype or key Key []byte // subtype or key
From, To uint64 // peer and db-specific entry count From, To uint64 // peer and db-specific entry count
Hashes []byte // stream of hashes (128) Hashes []byte // stream of hashes (128)
*HandoverProof `rlp:"nil"` // HandoverProof *HandoverProof // HandoverProof
} }
// String pretty prints OfferedHashesMsg // String pretty prints OfferedHashesMsg

View file

@ -136,7 +136,10 @@ func (self *testIncomingStreamer) BatchDone(string, uint64, []byte, []byte) func
} }
func (self *testOutgoingStreamer) SetNextBatch(from uint64, to uint64) ([]byte, uint64, uint64, *HandoverProof, error) { func (self *testOutgoingStreamer) SetNextBatch(from uint64, to uint64) ([]byte, uint64, uint64, *HandoverProof, error) {
return make([]byte, HashSize), from + 1, to + 1, nil, nil proof := &HandoverProof{
Handover: &Handover{},
}
return make([]byte, HashSize), from + 1, to + 1, proof, nil
} }
func (self *testOutgoingStreamer) GetData([]byte) []byte { func (self *testOutgoingStreamer) GetData([]byte) []byte {
@ -222,7 +225,9 @@ func TestStreamerUpstreamSubscribeMsgExchange(t *testing.T) {
Code: 1, Code: 1,
Msg: &OfferedHashesMsg{ Msg: &OfferedHashesMsg{
Stream: "foo", Stream: "foo",
HandoverProof: nil, HandoverProof: &HandoverProof{
Handover: &Handover{},
},
Hashes: make([]byte, HashSize), Hashes: make([]byte, HashSize),
From: 6, From: 6,
To: 9, To: 9,