diff --git a/src/ckdb.h b/src/ckdb.h index 9395b2b3..6a3bc10f 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.0" -#define CKDB_VERSION DB_VERSION"-1.100" +#define CKDB_VERSION DB_VERSION"-1.101" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_data.c b/src/ckdb_data.c index e4e620cb..6b097d6c 100644 --- a/src/ckdb_data.c +++ b/src/ckdb_data.c @@ -3875,6 +3875,7 @@ bool make_markersummaries(bool msg, char *by, char *code, char *inet, WORKMARKERS *workmarkers; K_ITEM *wm_item, *wm_last = NULL; tv_t now; + bool ok; K_RLOCK(workmarkers_free); wm_item = last_in_ktree(workmarkers_workinfoid_root, ctx); @@ -3916,8 +3917,15 @@ bool make_markersummaries(bool msg, char *by, char *code, char *inet, else setnow(&now); - return sharesummaries_to_markersummaries(NULL, workmarkers, by, code, - inet, &now, trf_root); + /* So we can't change any sharesummaries/markersummaries while a + * payout is being generated + * N.B. this is a long lock since it stores the markersummaries */ + ck_wlock(&process_pplns_lock); + ok = sharesummaries_to_markersummaries(NULL, workmarkers, by, code, + inet, &now, trf_root); + ck_wunlock(&process_pplns_lock); + + return ok; } void dsp_workmarkers(K_ITEM *item, FILE *stream)