mining: rename getCoinbaseTx() to ..RawTx()
What changed, and why it matters
This commit simply renames a function from getCoinbaseTx() to getCoinbaseRawTx() across the codebase, including documentation, interface definitions, IPC protocol files, implementation, and tests. It is a preparatory refactoring change with no functional or security impact.
No security action required. Treat as routine refactoring. Review the following commit to understand why the old name was freed up.
Security signals we found
No strong security signals were identified.
Evidence from the diff
Pure identifier rename in the mining IPC interface. The C++ virtual method, Cap’n Proto RPC method, implementation override, Python test calls, and release notes are all updated consistently. The function signature, sequence number (@5), and behavior remain unchanged. The commit explicitly states this is to free up the old name for a subsequent commit and that IPC clients are unaffected because they bind by signature and sequence number, not name.
Changed components
src/interfaces/mining.hsrc/ipc/capnp/mining.capnpsrc/node/interfaces.cpptest/functional/interface_ipc.pydoc/release-notes-33819.mdInspect captured patch +21 / −5
diff --git a/doc/release-notes-33819.md b/doc/release-notes-33819.md
new file mode 100644
index 00000000..6c1cebbd
--- /dev/null
+++ b/doc/release-notes-33819.md
@@ -0,0 +1,5 @@
+Mining IPC
+----------
+
+- The `getCoinbaseTx()` method is renamed to `getCoinbaseRawTx()`.
+ IPC clients do not use the function name, so they're not affected. (#33819)
diff --git a/src/interfaces/mining.h b/src/interfaces/mining.h
index 6e037691..97f90735 100644
--- a/src/interfaces/mining.h
+++ b/src/interfaces/mining.h
@@ -42,8 +42,19 @@ public:
// Sigop cost per transaction, not including coinbase transaction.
virtual std::vector<int64_t> getTxSigops() = 0;
- virtual CTransactionRef getCoinbaseTx() = 0;
+ /**
+ * Return serialized dummy coinbase transaction.
+ */
+ virtual CTransactionRef getCoinbaseRawTx() = 0;
+
+ /**
+ * Return scriptPubKey with SegWit OP_RETURN.
+ */
virtual std::vector<unsigned char> getCoinbaseCommitment() = 0;
+
+ /**
+ * Return which output in the dummy coinbase contains the SegWit OP_RETURN.
+ */
virtual int getWitnessCommitmentIndex() = 0;
/**
diff --git a/src/ipc/capnp/mining.capnp b/src/ipc/capnp/mining.capnp
index ed01e44a..85cff64d 100644
--- a/src/ipc/capnp/mining.capnp
+++ b/src/ipc/capnp/mining.capnp
@@ -27,7 +27,7 @@ interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") {
getBlock @2 (context: Proxy.Context) -> (result: Data);
getTxFees @3 (context: Proxy.Context) -> (result: List(Int64));
getTxSigops @4 (context: Proxy.Context) -> (result: List(Int64));
- getCoinbaseTx @5 (context: Proxy.Context) -> (result: Data);
+ getCoinbaseRawTx @5 (context: Proxy.Context) -> (result: Data);
getCoinbaseCommitment @6 (context: Proxy.Context) -> (result: Data);
getWitnessCommitmentIndex @7 (context: Proxy.Context) -> (result: Int32);
getCoinbaseMerklePath @8 (context: Proxy.Context) -> (result: List(Data));
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 5113f44f..8235e131 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -888,7 +888,7 @@ public:
return m_block_template->vTxSigOpsCost;
}
- CTransactionRef getCoinbaseTx() override
+ CTransactionRef getCoinbaseRawTx() override
{
return m_block_template->block.vtx[0];
}
diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py
index 7c8f51a8..c8bffd9f 100755
--- a/test/functional/interface_ipc.py
+++ b/test/functional/interface_ipc.py
@@ -123,7 +123,7 @@ class IPCInterfaceTest(BitcoinTestFramework):
return block
async def parse_and_deserialize_coinbase_tx(self, block_template, ctx):
- coinbase_data = BytesIO((await block_template.getCoinbaseTx(ctx)).result)
+ coinbase_data = BytesIO((await block_template.getCoinbaseRawTx(ctx)).result)
tx = CTransaction()
tx.deserialize(coinbase_data)
return tx
@@ -191,7 +191,7 @@ class IPCInterfaceTest(BitcoinTestFramework):
assert_equal(len(txfees.result), 0)
txsigops = await template.getTxSigops(ctx)
assert_equal(len(txsigops.result), 0)
- coinbase_data = BytesIO((await template.getCoinbaseTx(ctx)).result)
+ coinbase_data = BytesIO((await template.getCoinbaseRawTx(ctx)).result)
coinbase = CTransaction()
coinbase.deserialize(coinbase_data)
assert_equal(coinbase.vin[0].prevout.hash, 0)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.