diff --git a/blkmaker.c b/blkmaker.c index 63e32b8..4790814 100644 --- a/blkmaker.c +++ b/blkmaker.c @@ -56,20 +56,19 @@ bool _blkmk_dblsha256(void *hash, const void *data, size_t datasz) { #define dblsha256 _blkmk_dblsha256 uint64_t blkmk_init_generation3(blktemplate_t * const tmpl, const void * const script, const size_t scriptsz, bool * const inout_newcb) { - if (tmpl->cbtxn && !(*inout_newcb && (tmpl->mutations & BMM_GENERATE))) + const bool replace_existing = *inout_newcb; + *inout_newcb = false; + + if (tmpl->cbtxn && !(replace_existing && (tmpl->mutations & BMM_GENERATE))) { - *inout_newcb = false; return 0; } if (!tmpl->cbvalue) { // TODO: Figure it out from the existing cbtxn - *inout_newcb = false; return 0; } - *inout_newcb = true; - if (scriptsz >= 0xfd) return 0; @@ -133,6 +132,7 @@ uint64_t blkmk_init_generation3(blktemplate_t * const tmpl, const void * const s tmpl->mutations |= BMM_CBAPPEND | BMM_CBSET | BMM_GENERATE; + *inout_newcb = true; return tmpl->cbvalue; }