mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-18 03:07:51 +01:00
added filter to search based on NodeID
This commit is contained in:
@@ -9,6 +9,7 @@ package webapi
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/PeernetOfficial/core/protocol"
|
||||
"time"
|
||||
|
||||
"github.com/PeernetOfficial/core/blockchain"
|
||||
@@ -43,6 +44,12 @@ func (job *SearchJob) localSearch(api *WebapiInstance, term string) {
|
||||
|
||||
resultLoop:
|
||||
for _, result := range results {
|
||||
|
||||
// check if the NodeID filter is provided
|
||||
if job.filtersStart.NodeID != nil && !(bytes.Equal(job.filtersStart.NodeID, protocol.PublicKey2NodeID(result.PublicKey))) {
|
||||
continue
|
||||
}
|
||||
|
||||
file, _, found, err := api.Backend.ReadFile(result.PublicKey, result.BlockchainVersion, result.BlockNumber, result.FileID)
|
||||
if err != nil || !found {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user