fix: crash on control node side dutring handling edited shared address from the member who left the community (#4967)

This commit is contained in:
Mykhailo Prakhov 2024-03-22 15:25:37 +01:00 committed by GitHub
parent 14cf4b734f
commit b931a75bd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -1176,7 +1176,12 @@ func (o *Community) ValidateEditSharedAddresses(signer *ecdsa.PublicKey, request
return errors.New("no addresses were shared")
}
if request.Clock < o.config.CommunityDescription.Members[common.PubkeyToHex(signer)].LastUpdateClock {
member, exists := o.config.CommunityDescription.Members[common.PubkeyToHex(signer)]
if !exists {
return errors.New("signer is not a community member")
}
if request.Clock < member.LastUpdateClock {
return errors.New("edit request is older than the last one we have. Ignore")
}