Skip to content

Add extra debug logging for payout address, script hex in coinbase txn, etc#175

Open
yortug wants to merge 2 commits intoOCEAN-xyz:masterfrom
yortug:add-extra-debugs-for-coinbase-txn
Open

Add extra debug logging for payout address, script hex in coinbase txn, etc#175
yortug wants to merge 2 commits intoOCEAN-xyz:masterfrom
yortug:add-extra-debugs-for-coinbase-txn

Conversation

@yortug
Copy link
Copy Markdown

@yortug yortug commented Jan 25, 2026

This adds optional DLOG_DEBUG statements in src/datum_coinbaser.c to print:

  • Raw coinb1 and coinb2 hex (proof of built txn data)
  • Configured payout address
  • Payout value (sats + BTC)
  • Primary/secondary coinbase tags

Particularly useful when mining_pool_address = "" (i.e. NOT mining in the pool, "lottery" mining, keeping the reward, etc).

Under such circumstances, these extra debugs provide some extra confidence that the coinbasetxn has been built as expected, and (in the extremely unlikely scenario you hit a block) will send through to the correct address.

You cannot simple use bitcoin-cli getblocktemplate ... to address these concerns, as it doesn't have the additional context that DATUM is using here to stitch together the txn it's actually using.

If I did everything correctly, the logs should only appear at log level 0 (ALL) or 1 (DEBUG) - no impact at INFO or higher.

I've tested using a single BitAxe miner with mining_pool_address = "" and saw the expected output logged via journalctl -u datum_gateway -f.

If you don't think these would be useful, feel free to close - or, if there's a better way to implement debug logs like these, let me know!

giving the user confidence that coinbase transactions are being built as
expected (especially important when NOT mining into the pool, where it's
desirable for address payout / behaviour to be confirmed)
Comment thread src/datum_coinbaser.c
Comment on lines +463 to +464
DLOG_DEBUG("Coinbase payout address: %s", datum_config.mining_pool_address);
DLOG_DEBUG("Coinbase payout value: %" PRIu64 " sats (%.8f BTC)", s->coinbase_value, (double)s->coinbase_value / 100000000.0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coinbase is in lieu of inputs; it's not part of the outputs.

Comment thread src/datum_coinbaser.c
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't mess with all the whitespace!

Comment thread src/datum_coinbaser.c
Comment on lines +462 to +466
DLOG_DEBUG("Raw coinb2 outputs hex (payout + witness + locktime): %s", s->coinbase[0].coinb2);
DLOG_DEBUG("Coinbase payout address: %s", datum_config.mining_pool_address);
DLOG_DEBUG("Coinbase payout value: %" PRIu64 " sats (%.8f BTC)", s->coinbase_value, (double)s->coinbase_value / 100000000.0);
DLOG_DEBUG("Coinbase primary tag: %s", datum_config.mining_coinbase_tag_primary);
DLOG_DEBUG("Coinbase secondary tag: %s", datum_config.mining_coinbase_tag_secondary);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tabs to indent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants