Skip to content

Commit fbce29b

Browse files
committed
Use prevblock height as locktime for new block generation tx
1 parent 9379725 commit fbce29b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/datum_coinbaser.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void generate_coinbase_txns_for_stratum_job_subtypebysize(T_DATUM_STRATUM_JOB *s
307307
// append the default_witness_commitment
308308
cb2idx[coinbase_index] += sprintf(&s->coinbase[coinbase_index].coinb2[cb2idx[coinbase_index]], "0000000000000000%2.2x%s", (unsigned char)strlen(s->block_template->default_witness_commitment)>>1, s->block_template->default_witness_commitment);
309309
// lock time
310-
cb2idx[coinbase_index] += sprintf(&s->coinbase[coinbase_index].coinb2[cb2idx[coinbase_index]], "00000000");
310+
cb2idx[coinbase_index] += sprintf(&s->coinbase[coinbase_index].coinb2[cb2idx[coinbase_index]], "%8.8lx", (unsigned long)(uint32_t)(s->height - 1));
311311
}
312312

313313
int datum_stratum_coinbase_fit_to_template(int max_sz, int fixed_bytes, T_DATUM_STRATUM_JOB *s) {
@@ -455,7 +455,7 @@ void generate_base_coinbase_txns_for_stratum_job(T_DATUM_STRATUM_JOB *s, bool ne
455455
// append the default_witness_commitment
456456
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "0000000000000000%2.2x%s", (unsigned char)strlen(s->block_template->default_witness_commitment)>>1, s->block_template->default_witness_commitment);
457457
// lock time
458-
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "00000000");
458+
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "%8.8lx", (unsigned long)(uint32_t)(s->height - 1));
459459

460460
if (new_block) {
461461
// Append the subsidy-only payout to the subsidy_only_coinbase
@@ -661,7 +661,7 @@ void generate_coinbase_txns_for_stratum_job(T_DATUM_STRATUM_JOB *s, bool empty_o
661661
// append the default_witness_commitment
662662
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "0000000000000000%2.2x%s", (unsigned char)strlen(s->block_template->default_witness_commitment)>>1, s->block_template->default_witness_commitment);
663663
// lock time
664-
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "00000000");
664+
cb2idx[0] += sprintf(&s->coinbase[0].coinb2[cb2idx[0]], "%8.8lx", (unsigned long)(uint32_t)(s->height - 1));
665665

666666
if (empty_only) {
667667
// Append the subsidy-only payout to the subsidy_only_coinbase

0 commit comments

Comments
 (0)