added filter to search based on NodeID

This commit is contained in:
2023-06-26 12:26:49 +01:00
parent 09d418956f
commit fea2209083
5 changed files with 41 additions and 4 deletions

View File

@@ -98,6 +98,26 @@ func (api *WebapiInstance) GreedySearchMergeDirection(nodeID *[][]byte, fileType
var filesFromPeer uint64
//var Name string
//
//ProfileNameFound := false
//
//// First iteration of the entire blockchain to search for the profile
//// image and Username of the user
//for blockN1 := peer.BlockchainHeight - 1; blockN1 > 0; blockN1-- {
// blockDecoded, _, found, _ := api.Backend.ReadBlock(peer.PublicKey, peer.BlockchainVersion, blockN1)
// if !found {
// continue
// }
// // Adding profile image and Username to the output
// for raw := range blockDecoded.Block.RecordsRaw {
// if blockDecoded.Block.RecordsRaw[raw].Type == blockchain.ProfileName && !ProfileNameFound {
// Name = string(blockDecoded.Block.RecordsRaw[raw].Data[:])
// ProfileNameFound = true
// }
// }
//}
// decode blocks from top down
for blockN := peer.BlockchainHeight - 1; blockN > 0; blockN-- {
blockDecoded, _, found, _ := api.Backend.ReadBlock(peer.PublicKey, peer.BlockchainVersion, blockN)
@@ -114,6 +134,8 @@ func (api *WebapiInstance) GreedySearchMergeDirection(nodeID *[][]byte, fileType
file.Tags = append(file.Tags, blockchain.TagFromText(blockchain.TagSharedByGeoIP, sharedByGeoIP))
}
//file.Username = Name
// if both the hashes match
if bytes.Equal(file.Hash, hash) {
// set the Tags needed for the filter parameter