From 73233a4e4e2cf96662288c6ece211bd098ef1ed1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 7 Nov 2016 20:58:45 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_rpc.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 305cecaa5..9961025d1 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -478,14 +478,20 @@ cJSON *dpow_paxjson(struct pax_transaction *pax) uint64_t dpow_paxtotal(struct dpow_info *dp) { struct pax_transaction *pax,*tmp; uint64_t total = 0; - tmp = 0; - while ( dp->PAX != 0 && (pax= dp->PAX->hh.next) != 0 && pax != tmp ) + pthread_mutex_lock(&dp->mutex); + if ( dp->PAX != 0 ) { - if ( pax->marked == 0 ) - total += pax->fiatoshis; - tmp = pax; - pax = pax->hh.next; + tmp = 0; + pax= dp->PAX->hh.next; + while ( pax != 0 && pax != tmp ) + { + if ( pax->marked == 0 ) + total += pax->komodoshis; + tmp = pax; + pax = pax->hh.next; + } } + pthread_mutex_unlock(&dp->mutex); return(total); } @@ -528,15 +534,19 @@ cJSON *dpow_withdraws_pending(struct dpow_info *dp) { struct pax_transaction *pax,*tmp; cJSON *retjson = cJSON_CreateArray(); pthread_mutex_lock(&dp->mutex); - tmp = 0; - while ( dp->PAX != 0 && (pax= dp->PAX->hh.next) != 0 && pax != tmp ) + if ( dp->PAX != 0 ) { - if ( pax->marked == 0 ) - jaddi(retjson,dpow_paxjson(pax)); - tmp = pax; - pax = pax->hh.next; + tmp = 0; + pax = dp->PAX->hh.next; + while ( pax != 0 && pax != tmp ) + { + if ( pax->marked == 0 ) + jaddi(retjson,dpow_paxjson(pax)); + tmp = pax; + pax = pax->hh.next; + } + pthread_mutex_unlock(&dp->mutex); } - pthread_mutex_unlock(&dp->mutex); return(retjson); }