don't verify own block parts

This commit is contained in:
Ethan Buchman
2016-03-11 21:38:15 -05:00
parent 5e42c96267
commit 79c9a9f03a
2 changed files with 8 additions and 7 deletions

View File

@ -188,7 +188,7 @@ func (ps *PartSet) Total() int {
return ps.total
}
func (ps *PartSet) AddPart(part *Part) (bool, error) {
func (ps *PartSet) AddPart(part *Part, verify bool) (bool, error) {
ps.mtx.Lock()
defer ps.mtx.Unlock()
@ -203,9 +203,10 @@ func (ps *PartSet) AddPart(part *Part) (bool, error) {
}
// Check hash proof
// TODO: minor gains for not checking part sets we made
if !part.Proof.Verify(part.Index, ps.total, part.Hash(), ps.Hash()) {
return false, ErrPartSetInvalidProof
if verify {
if !part.Proof.Verify(part.Index, ps.total, part.Hash(), ps.Hash()) {
return false, ErrPartSetInvalidProof
}
}
// Add part