change rpc method name

pull/3857/head
haodi 3 years ago
parent 9621cec66c
commit 74ccff461e
  1. 4
      rpc/harmony.go
  2. 20
      rpc/pool.go

@ -87,8 +87,8 @@ func (s *PublicHarmonyService) GetPeerInfo(
return NewStructuredResponse(s.hmy.GetPeerInfo())
}
// GetPendingCrosslinks returns length of hmy.BlockChain.ReadPendingCrossLinks()
func (s *PublicHarmonyService) GetPendingCrosslinks() (int, error) {
// GetNumPendingCrossLinks returns length of hmy.BlockChain.ReadPendingCrossLinks()
func (s *PublicHarmonyService) GetNumPendingCrossLinks() (int, error) {
links, err := s.hmy.BlockChain.ReadPendingCrossLinks()
if err != nil {
return 0, err

@ -364,3 +364,23 @@ func (s *PublicPoolService) GetPendingCXReceipts(
}
return formattedReceipts, nil
}
// GetNumPendingCXReceipts ..
func (s *PublicPoolService) GetNumPendingCXReceipts(
ctx context.Context,
) (int, error) {
timer := DoMetricRPCRequest(GetPendingCXReceipts)
defer DoRPCRequestDuration(GetPendingCXReceipts, timer)
// For each cx receipt, format the response (same format for all versions)
formattedReceipts := []StructuredResponse{}
for _, receipts := range s.hmy.GetPendingCXReceipts() {
formattedReceipt, err := NewStructuredResponse(receipts)
if err != nil {
DoMetricRPCQueryInfo(GetPendingCXReceipts, FailedNumber)
return 0, err
}
formattedReceipts = append(formattedReceipts, formattedReceipt)
}
return len(formattedReceipts), nil
}

Loading…
Cancel
Save