blkmk_get_mdata: Accept can_roll_ntime as an argument
This commit is contained in:
14
README
14
README
@@ -10,7 +10,13 @@ Note that you must assign blkmk_sha256_impl to a function pointer:
|
||||
bool mysha256(void *hash_out, const void *data, size_t datasz)
|
||||
hash_out must be able to overlap with data!
|
||||
|
||||
Also note that you should NOT roll ntime for data retrieved; while it will
|
||||
probably work, there is no guarantee it won't fall outside the maxtime limits
|
||||
for the blocktemplate. It is usually best to simply get more data as often
|
||||
as it is needed.
|
||||
Also note that you should NOT roll ntime for data retrieved without explicitly
|
||||
checking that it falls within the template's limitations (mintime, maxtime,
|
||||
mintimeoff, and maxtimeoff); read the BIP 23 specification in detail to
|
||||
understand how they work. It is usually best to simply get more data as often
|
||||
as it is needed. For blkmk_get_mdata, you may specify that you intend to roll
|
||||
the ntime header exactly once per second past usetime - it will then set
|
||||
*out_expires such that the expiration occurs before you roll beyond any ntime
|
||||
limits. If you are rolling ntime at any rate other than once per second, you
|
||||
should NOT specify can_roll_ntime to blkmk_get_mdata, and must check that your
|
||||
usage falls within the explicit template limits yourself.
|
||||
|
||||
@@ -345,7 +345,7 @@ size_t blkmk_get_data(blktemplate_t *tmpl, void *buf, size_t bufsz, time_t useti
|
||||
return 76;
|
||||
}
|
||||
|
||||
bool blkmk_get_mdata(blktemplate_t * const tmpl, void * const buf, const size_t bufsz, const time_t usetime, int16_t * const out_expire, void * const _out_cbtxn, size_t * const out_cbtxnsz, size_t * const cbextranonceoffset, int * const out_branchcount, void * const _out_branches, size_t extranoncesz)
|
||||
bool blkmk_get_mdata(blktemplate_t * const tmpl, void * const buf, const size_t bufsz, const time_t usetime, int16_t * const out_expire, void * const _out_cbtxn, size_t * const out_cbtxnsz, size_t * const cbextranonceoffset, int * const out_branchcount, void * const _out_branches, size_t extranoncesz, const bool can_roll_ntime)
|
||||
{
|
||||
if (!(true
|
||||
&& blkmk_time_left(tmpl, usetime)
|
||||
@@ -378,7 +378,7 @@ bool blkmk_get_mdata(blktemplate_t * const tmpl, void * const buf, const size_t
|
||||
return false;
|
||||
}
|
||||
|
||||
blkmk_set_times(tmpl, &cbuf[68], usetime, out_expire, true);
|
||||
blkmk_set_times(tmpl, &cbuf[68], usetime, out_expire, can_roll_ntime);
|
||||
memcpy(&cbuf[72], &tmpl->diffbits, 4);
|
||||
|
||||
*out_branchcount = tmpl->_mrklbranchcount;
|
||||
|
||||
@@ -19,7 +19,7 @@ extern ssize_t blkmk_append_coinbase_safe(blktemplate_t *, const void *append, s
|
||||
extern ssize_t blkmk_append_coinbase_safe2(blktemplate_t *, const void *append, size_t appendsz, int extranoncesz, bool merkle_only);
|
||||
extern bool _blkmk_extranonce(blktemplate_t *tmpl, void *vout, unsigned int workid, size_t *offs);
|
||||
extern size_t blkmk_get_data(blktemplate_t *, void *buf, size_t bufsz, time_t usetime, int16_t *out_expire, unsigned int *out_dataid);
|
||||
extern bool blkmk_get_mdata(blktemplate_t *, void *buf, size_t bufsz, time_t usetime, int16_t *out_expire, void *out_cbtxn, size_t *out_cbtxnsz, size_t *cbextranonceoffset, int *out_branchcount, void *out_branches, size_t extranoncesz);
|
||||
extern bool blkmk_get_mdata(blktemplate_t *, void *buf, size_t bufsz, time_t usetime, int16_t *out_expire, void *out_cbtxn, size_t *out_cbtxnsz, size_t *cbextranonceoffset, int *out_branchcount, void *out_branches, size_t extranoncesz, bool can_roll_ntime);
|
||||
extern blktime_diff_t blkmk_time_left(const blktemplate_t *, time_t nowtime);
|
||||
extern unsigned long blkmk_work_left(const blktemplate_t *);
|
||||
#define BLKMK_UNLIMITED_WORK_COUNT ULONG_MAX
|
||||
|
||||
Reference in New Issue
Block a user