list all claims at once (faster)
This commit is contained in:
parent
77749f05ba
commit
6d2e4aa6e6
1 changed files with 5 additions and 10 deletions
|
@ -660,8 +660,6 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim, ownClaims []jsonrpc.Claim)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sync) getClaims(defaultOnly bool) ([]jsonrpc.Claim, error) {
|
func (s *Sync) getClaims(defaultOnly bool) ([]jsonrpc.Claim, error) {
|
||||||
totalPages := uint64(1)
|
|
||||||
var allClaims []jsonrpc.Claim
|
|
||||||
var account *string = nil
|
var account *string = nil
|
||||||
if defaultOnly {
|
if defaultOnly {
|
||||||
a, err := s.getDefaultAccount()
|
a, err := s.getDefaultAccount()
|
||||||
|
@ -670,15 +668,12 @@ func (s *Sync) getClaims(defaultOnly bool) ([]jsonrpc.Claim, error) {
|
||||||
}
|
}
|
||||||
account = &a
|
account = &a
|
||||||
}
|
}
|
||||||
for page := uint64(1); page <= totalPages; page++ {
|
claims, err := s.daemon.StreamList(account)
|
||||||
claims, err := s.daemon.ClaimList(account, page, 50)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Prefix("cannot list claims", err)
|
return nil, errors.Prefix("cannot list claims", err)
|
||||||
}
|
}
|
||||||
allClaims = append(allClaims, (*claims).Claims...)
|
|
||||||
totalPages = (*claims).TotalPages
|
return *claims, nil
|
||||||
}
|
|
||||||
return allClaims, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sync) checkIntegrity() error {
|
func (s *Sync) checkIntegrity() error {
|
||||||
|
|
Loading…
Reference in a new issue