I am attempting to make a simple change to the bitcoin core codebase locally but my changes are not reflected after recompilation. Below are the steps to reproduce the issue:
Clone the bitcoin source code:
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
Edit: src/rpc/rawtransaction.cpp
and change something (anything). Here I just put "HELLO WORLD"
in the signrawtransactionwithkey
method as shown below and left everything else the same:
static RPCHelpMan signrawtransactionwithkey()
{
return RPCHelpMan{"signrawtransactionwithkey",
"\n HELLO WORLD Sign inputs for raw transaction (serialized, hex-encoded).\n"
... <code continues> ...
Recompile:
./autogen.sh
./configure
make -j 16
make
command output:
Making all in src
make[1]: Entering directory '/home/bitcoinfacts/bitcoin/src'
make[2]: Entering directory '/home/bitcoinfacts/bitcoin/src'
make[3]: Entering directory '/home/bitcoinfacts/bitcoin'
make[3]: Leaving directory '/home/bitcoinfacts/bitcoin'
CXXLD qt/bitcoin-qt
CXXLD test/fuzz/fuzz
CXXLD qt/test/test_bitcoin-qt
make[2]: Leaving directory '/home/bitcoinfacts/bitcoin/src'
make[1]: Leaving directory '/home/bitcoinfacts/bitcoin/src'
Making all in doc/man
make[1]: Entering directory '/home/bitcoinfacts/bitcoin/doc/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/bitcoinfacts/bitcoin/doc/man'
make[1]: Entering directory '/home/bitcoinfacts/bitcoin'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/bitcoinfacts/bitcoin'
Run the signrawtransactionwithkey
command:
./src/bitcoin-cli signrawtransactionwithkey
The output does not include HELLO WORLD
:
error code: -1
error message:
signrawtransactionwithkey "hexstring" ["privatekey",...] ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )
Sign inputs for raw transaction (serialized, hex-encoded).
... <output continues> ...
Why? What I am I doing wrong?
The reason was that I had to kill and restart bitcoind
because that's where the change actually was (not bitcoin-cli, as I previously thought. Duh!)