Page MenuHomePhabricator

make chronik-client_blocktxs_and_tx_and_rawtx work even when the wallet is not compiled
ClosedPublic

Authored by PiRK on Feb 9 2024, 12:10.

Details

Summary

This setup_script used the sendtoaddress and getnewaddress RPCs which are not available if the node is built without the wallet. We can use the MiniWallet from the test framework instead which works without the node's wallet.

The only notable change in behaviour is that now the transactions are all sent to the same address. This does not seem to affect the corresponding integration test.

Test Plan
mkdir buildChronikWithoutWallet
cd buildChronikWithoutWallet
cmake -GNinja .. -DBUILD_BITCOIN_CHRONIK=ON -DBUILD_BITCOIN_WALLET=OFF
ninja check-functional
./test/functional/test_runner.py setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx

Type next until the script completes succesfuly.

Then:

cd ..
cd modules/chronik-client
BUILD_DIR="${PWD}/../../buildChronikWithoutWallet" npm run integration-tests

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Feb 9 2024, 12:10
PiRK planned changes to this revision.Feb 9 2024, 12:17

maybe this can be better fixed by using the MiniWallet from the test framework

make the setup script work even when the wallet is not compiled

PiRK retitled this revision from add self.skip_if_no_wallet() to s etup script using wallet RPCs to make chronik-client_blocktxs_and_tx_and_rawtx work even when the wallet is not compiled.Feb 9 2024, 13:53
PiRK edited the summary of this revision. (Show Details)
PiRK edited the test plan for this revision. (Show Details)
PiRK edited the test plan for this revision. (Show Details)

remove blank lines added by accident

test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py
32 ↗(On Diff #45099)

This populates the wallet with the 25 mature coinbase UTXOs from the 200 pre-mined blocks that happen to be sent to the address controlled by the MiniWallet.

bytesofman added inline comments.
test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py
42 ↗(On Diff #45099)

is the amount itself then some default if fee_rate is set?

test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py
42 ↗(On Diff #45099)

This function basically takes one utxo from the wallet and sends it back to the wallet. It does not give control over the amount. Here the amount will always be the coinbase amount (50 MXEC) minus the fee, because we only have those 50 coinbase UTXOs from the premine regtest chain in the wallet.
If we expect to need finer control over the transactions (amount, destination...) in the future, it is possible with the wallet.send_to function (test/functional/test_framework/wallet.py line 138). But then we would need to hardcode the destination addresses in this script, because the MiniWallet cannot generate new addresses, it is a single address wallet.

@bot chronik-client-integration-tests

This revision is now accepted and ready to land.Feb 10 2024, 00:40