Page MenuHomePhabricator

Avoid dumpprivkey in wallet_listsinceblock.py
ClosedPublic

Authored by PiRK on Dec 9 2021, 15:15.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC51cb39c87b0b: Avoid dumpprivkey in wallet_listsinceblock.py
Summary

Generate a privkey in the test framework instead of using dumpprivkey so
that descriptor wallets work in this test.

This is a backport of core#18788 [4/16] & core#20322 (adds a sync_all)
https://github.com/bitcoin/bitcoin/pull/18788/commits/c2711e4230d9a423ead24f6609691fb338b1d26b
https://github.com/bitcoin/bitcoin/pull/20322/commits/444412821e5349ce0e0b039d884583edb70c4399

I also had to add a key_to_p2pkh_cashaddr function to get the address in the correct format. This has the added benefit of adding coverage for cashaddr.encode[_full] which was unused before this commit, as far as I can tell.

Test Plan

test/functional/test_runner.py wallet_listsinceblock

Event Timeline

PiRK requested review of this revision.Dec 9 2021, 15:15

Tail of the build log:

[400/455] bitcoin: testing sync_tests
[401/455] bitcoin: testing torcontrol_tests
[402/455] Running utility command for check-bitcoin-scheduler_tests
[403/455] bitcoin: testing intmath_tests
[404/455] Running utility command for check-bitcoin-sync_tests
[405/455] Running utility command for check-bitcoin-torcontrol_tests
[406/455] bitcoin: testing settings_tests
[407/455] Running utility command for check-bitcoin-intmath_tests
[408/455] Running utility command for check-bitcoin-settings_tests
[409/455] bitcoin: testing streams_tests
[410/455] bitcoin: testing validation_flush_tests
[411/455] bitcoin: testing timedata_tests
[412/455] bitcoin: testing compilerbug_tests
[413/455] Running utility command for check-bitcoin-streams_tests
[414/455] Running utility command for check-bitcoin-timedata_tests
[415/455] bitcoin: testing checkpoints_tests
[416/455] Running utility command for check-bitcoin-validation_flush_tests
[417/455] Running utility command for check-bitcoin-compilerbug_tests
[418/455] bitcoin: testing blockcheck_tests
[419/455] Running utility command for check-bitcoin-checkpoints_tests
[420/455] Running utility command for check-bitcoin-blockcheck_tests
[421/455] bitcoin: testing wallet_tests
[422/455] bitcoin: testing validationinterface_tests
[423/455] Running utility command for check-avalanche-processor_tests
[424/455] Running utility command for check-bitcoin-wallet_tests
[425/455] bitcoin: testing serialize_tests
[426/455] Running avalanche test suite
PASSED: avalanche test suite
[427/455] Running utility command for check-bitcoin-validationinterface_tests
[428/455] Running utility command for check-pow-grasberg_tests
[429/455] bitcoin: testing script_standard_tests
[430/455] Running utility command for check-pow-aserti32d_tests
[431/455] Running utility command for check-bitcoin-serialize_tests
[432/455] Running pow test suite
PASSED: pow test suite
[433/455] Running utility command for check-bitcoin-script_standard_tests
[434/455] bitcoin: testing cashaddr_tests
[435/455] bitcoin: testing schnorr_tests
[436/455] Running utility command for check-bitcoin-cashaddr_tests
[437/455] Running utility command for check-bitcoin-schnorr_tests
[438/455] Linking CXX executable src/qt/test/test_bitcoin-qt
[439/455] bitcoin: testing versionbits_tests
[440/455] Running utility command for check-bitcoin-versionbits_tests
[441/455] bitcoin: testing script_tests
[442/455] Running utility command for check-bitcoin-script_tests
[443/455] bitcoin: testing monolith_opcodes_tests
[444/455] bitcoin: testing crypto_tests
[445/455] Running utility command for check-bitcoin-monolith_opcodes_tests
[446/455] Running utility command for check-bitcoin-crypto_tests
[447/455] secp256k1: testing secp256k1-exhaustive_tests
[448/455] bitcoin-qt: testing test_bitcoin-qt
[449/455] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[450/455] bitcoin: testing coins_tests
[451/455] Running utility command for check-bitcoin-coins_tests
[452/455] secp256k1: testing secp256k1-tests
[453/455] Running secp256k1 test suite
PASSED: secp256k1 test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
Fabien requested changes to this revision.Dec 10 2021, 09:08
Fabien added a subscriber: Fabien.
Fabien added inline comments.
test/functional/test_framework/address.py
85

That doesn't seem very useful: you already have the key, you can just call cashaddr.encode_full in the test where needed. That way you don't need to presume what the output format of key_to_p2pkh is.

This revision now requires changes to proceed.Dec 10 2021, 09:08

convert pubkey to cashadddr directly in the test, avoid creating a helper function.

This revision is now accepted and ready to land.Dec 11 2021, 12:32