jl777 8 years ago
parent
commit
73233a4e4e
  1. 16
      iguana/dpow/dpow_rpc.c

16
iguana/dpow/dpow_rpc.c

@ -478,14 +478,20 @@ cJSON *dpow_paxjson(struct pax_transaction *pax)
uint64_t dpow_paxtotal(struct dpow_info *dp) uint64_t dpow_paxtotal(struct dpow_info *dp)
{ {
struct pax_transaction *pax,*tmp; uint64_t total = 0; struct pax_transaction *pax,*tmp; uint64_t total = 0;
pthread_mutex_lock(&dp->mutex);
if ( dp->PAX != 0 )
{
tmp = 0; tmp = 0;
while ( dp->PAX != 0 && (pax= dp->PAX->hh.next) != 0 && pax != tmp ) pax= dp->PAX->hh.next;
while ( pax != 0 && pax != tmp )
{ {
if ( pax->marked == 0 ) if ( pax->marked == 0 )
total += pax->fiatoshis; total += pax->komodoshis;
tmp = pax; tmp = pax;
pax = pax->hh.next; pax = pax->hh.next;
} }
}
pthread_mutex_unlock(&dp->mutex);
return(total); return(total);
} }
@ -528,8 +534,11 @@ cJSON *dpow_withdraws_pending(struct dpow_info *dp)
{ {
struct pax_transaction *pax,*tmp; cJSON *retjson = cJSON_CreateArray(); struct pax_transaction *pax,*tmp; cJSON *retjson = cJSON_CreateArray();
pthread_mutex_lock(&dp->mutex); pthread_mutex_lock(&dp->mutex);
if ( dp->PAX != 0 )
{
tmp = 0; tmp = 0;
while ( dp->PAX != 0 && (pax= dp->PAX->hh.next) != 0 && pax != tmp ) pax = dp->PAX->hh.next;
while ( pax != 0 && pax != tmp )
{ {
if ( pax->marked == 0 ) if ( pax->marked == 0 )
jaddi(retjson,dpow_paxjson(pax)); jaddi(retjson,dpow_paxjson(pax));
@ -537,6 +546,7 @@ cJSON *dpow_withdraws_pending(struct dpow_info *dp)
pax = pax->hh.next; pax = pax->hh.next;
} }
pthread_mutex_unlock(&dp->mutex); pthread_mutex_unlock(&dp->mutex);
}
return(retjson); return(retjson);
} }

Loading…
Cancel
Save