Page MenuHomePhabricator

[avalanche] rename getProof to getLocalProof and return a pointer
AbandonedPublic

Authored by PiRK on Apr 11 2021, 07:57.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

This will make it possible to use Processor::getProof(proofid) in
D9370 to get any proof, not only the proof used by the local node.

It now returns a pointer. This avoids doing a copy of the proof and
having to catch an error to find out that there is none (instead we can
just check for nullptr). It will solve the copy issue mentioned in the review of D9368.

A pointer is necessary because C++ does not seem to allow optional references.

Test Plan

ninja && test/functional/test_runner.py abc_p2p_avalanche abc_rpc_avalancheproof

Event Timeline

PiRK requested review of this revision.Apr 11 2021, 07:58

Tail of the build log:

[388/446] bitcoin: testing finalization_tests
[389/446] Running utility command for check-bitcoin-scheduler_tests
[390/446] bitcoin: testing merkleblock_tests
[391/446] bitcoin: testing script_commitment_tests
[392/446] Running utility command for check-bitcoin-finalization_tests
[393/446] bitcoin: testing sighashtype_tests
[394/446] bitcoin: testing bip32_tests
[395/446] Running utility command for check-bitcoin-merkleblock_tests
[396/446] Running utility command for check-bitcoin-script_commitment_tests
[397/446] Running utility command for check-bitcoin-sighashtype_tests
[398/446] Running utility command for check-bitcoin-bip32_tests
[399/446] bitcoin: testing transaction_tests
[400/446] Running utility command for check-bitcoin-transaction_tests
[401/446] bitcoin: testing settings_tests
[402/446] bitcoin: testing scriptpubkeyman_tests
[403/446] Running utility command for check-bitcoin-settings_tests
[404/446] bitcoin: testing timedata_tests
[405/446] bitcoin: testing uint256_tests
[406/446] Running utility command for check-bitcoin-scriptpubkeyman_tests
[407/446] bitcoin: testing streams_tests
[408/446] Running utility command for check-bitcoin-timedata_tests
[409/446] Running utility command for check-bitcoin-uint256_tests
[410/446] Running utility command for check-bitcoin-streams_tests
[411/446] bitcoin: testing walletdb_tests
[412/446] bitcoin: testing script_standard_tests
[413/446] Running utility command for check-bitcoin-walletdb_tests
[414/446] Running utility command for check-bitcoin-script_standard_tests
[415/446] bitcoin: testing txvalidationcache_tests
[416/446] bitcoin: testing serialize_tests
[417/446] Running utility command for check-bitcoin-txvalidationcache_tests
[418/446] bitcoin: testing getarg_tests
[419/446] Running utility command for check-bitcoin-serialize_tests
[420/446] Running utility command for check-bitcoin-getarg_tests
[421/446] bitcoin: testing versionbits_tests
[422/446] Running utility command for check-bitcoin-versionbits_tests
[423/446] bitcoin: testing schnorr_tests
[424/446] Running utility command for check-bitcoin-schnorr_tests
[425/446] bitcoin: testing validation_block_tests
[426/446] Running utility command for check-bitcoin-validation_block_tests
[427/446] bitcoin: testing radix_tests
[428/446] bitcoin: testing wallet_tests
[429/446] Running utility command for check-bitcoin-radix_tests
[430/446] secp256k1: testing secp256k1-tests
[431/446] Running secp256k1 test suite
PASSED: secp256k1 test suite
[432/446] bitcoin: testing monolith_opcodes_tests
[433/446] Running utility command for check-bitcoin-wallet_tests
[434/446] Running utility command for check-bitcoin-monolith_opcodes_tests
[435/446] bitcoin: testing script_tests
[436/446] Running utility command for check-bitcoin-script_tests
[437/446] bitcoin: testing skiplist_tests
[438/446] Running utility command for check-bitcoin-skiplist_tests
[439/446] bitcoin: testing blockcheck_tests
[440/446] Running utility command for check-bitcoin-blockcheck_tests
[441/446] bitcoin: testing op_reversebytes_tests
[442/446] Running utility command for check-bitcoin-op_reversebytes_tests
[443/446] bitcoin: testing coins_tests
[444/446] Running utility command for check-bitcoin-coins_tests
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
deadalnix requested changes to this revision.Apr 11 2021, 15:09
deadalnix added a subscriber: deadalnix.

You need to find what the right API for initialization is. Fixing the current API is mostly motion not progress. If you initialized where thing should be initialized, you wouldn't need to access the proof here now (maybe later, but later is later) and therefore, you wouldn't need to figure out what is the right API to access the proof.

You need to put things in their proper place, or you'll be playing wack a mole like in this patch forever and it's only going to get worse.

This revision now requires changes to proceed.Apr 11 2021, 15:09

This can be abandoned in favor of D9418. The reference to an optional proof is better than a bare pointer.