mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
fbddd23cd4
f685a13bef0418663015ea6d8f448f075510c0ec doc: GetTransaction()/getrawtransaction follow-ups to #22383 (John Newbery)
abc57e1f0882a1a2bb20474648419979af6e383d refactor: move `GetTransaction(...)` to node/transaction.cpp (Sebastian Falbesoner)
Pull request description:
~This PR is based on #22383, which should be reviewed first~ (merged by now).
In [yesterday's PR review club session to PR 22383](https://bitcoincore.reviews/22383), the idea of moving the function `GetTransaction(...)` from src/validation.cpp to src/node/transaction.cpp came up. With this, the circular dependency "index/txindex -> validation -> index/txindex" is removed (see change in `lint-circular-dependencies.sh`). Thanks to jnewbery for suggesting and to sipa for providing historical background.
Relevant IRC log:
```
17:52 <jnewbery> Was anyone surprised that GetTransaction() is in validation.cpp? It seems to me that node/transaction.cpp would be a more appropriate place for it.
17:53 <raj_> jnewbery, +1
17:53 <stickies-v> agreed!
17:54 <glozow> jnewbery ya
17:54 <jnewbery> seems weird that validation would call into txindex. I wonder if we remove this function, then validation would no longer need to #include txindex
17:54 <sipa> GetTransaction predates node/transaction.cpp, and even the generic index framework itself :)
17:55 <sipa> (before 0.8, validation itself used the txindex)
17:55 <jnewbery> (and GetTransaction() seems like a natural sibling to BroadcastTransaction(), which is already in node/transaction.cpp)
17:55 <jnewbery> sipa: right, this is not meant as a criticism of course. Just wondering if we can organize things a bit more rationally now that we have better separation between things.
17:55 <sipa> jnewbery: sure, just providing background
17:56 <sipa> seems very reasonable to move it elsewhere now
```
The commit should be trivial to review with `--color-moved`.
ACKs for top commit:
jnewbery:
Code review ACK f685a13bef0418663015ea6d8f448f075510c0ec
rajarshimaitra:
tACK f685a13bef
mjdietzx:
crACK f685a13bef0418663015ea6d8f448f075510c0ec
LarryRuane:
Code review, test ACK f685a13bef0418663015ea6d8f448f075510c0ec
Tree-SHA512: 0e844a6ecb1be04c638b55bc4478c2949549a4fcae01c984eee078de74d176fb19d508fc09360a62ad130677bfa7daf703b67870800e55942838d7313246248c
147 lines
7.3 KiB
Bash
Executable File
147 lines
7.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2018-2020 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
#
|
|
# Check for circular dependencies
|
|
|
|
export LC_ALL=C
|
|
|
|
EXPECTED_CIRCULAR_DEPENDENCIES=(
|
|
"chainparamsbase -> util/system -> chainparamsbase"
|
|
"node/blockstorage -> validation -> node/blockstorage"
|
|
"index/blockfilterindex -> node/blockstorage -> validation -> index/blockfilterindex"
|
|
"index/base -> validation -> index/blockfilterindex -> index/base"
|
|
"index/coinstatsindex -> node/coinstats -> index/coinstatsindex"
|
|
"policy/fees -> txmempool -> policy/fees"
|
|
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
|
|
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
|
|
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
|
|
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
|
|
"txmempool -> validation -> txmempool"
|
|
"wallet/fees -> wallet/wallet -> wallet/fees"
|
|
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
|
|
"node/coinstats -> validation -> node/coinstats"
|
|
# Dash
|
|
"coinjoin/server -> net_processing -> coinjoin/server"
|
|
"dsnotificationinterface -> llmq/chainlocks -> node/blockstorage -> dsnotificationinterface"
|
|
"evo/cbtx -> evo/simplifiedmns -> evo/cbtx"
|
|
"evo/deterministicmns -> llmq/commitment -> evo/deterministicmns"
|
|
"evo/deterministicmns -> llmq/utils -> evo/deterministicmns"
|
|
"evo/mnauth -> net_processing -> evo/mnauth"
|
|
"governance/classes -> governance/governance -> governance/classes"
|
|
"governance/governance -> governance/object -> governance/governance"
|
|
"governance/governance -> masternode/sync -> governance/governance"
|
|
"governance/governance -> net_processing -> governance/governance"
|
|
"governance/object -> governance/validators -> governance/object"
|
|
"llmq/quorums -> llmq/utils -> llmq/quorums"
|
|
"llmq/blockprocessor -> net_processing -> llmq/blockprocessor"
|
|
"llmq/chainlocks -> llmq/instantsend -> llmq/chainlocks"
|
|
"llmq/chainlocks -> net_processing -> llmq/chainlocks"
|
|
"llmq/dkgsessionmgr -> net_processing -> llmq/dkgsessionmgr"
|
|
"llmq/instantsend -> net_processing -> llmq/instantsend"
|
|
"llmq/instantsend -> txmempool -> llmq/instantsend"
|
|
"llmq/instantsend -> validation -> llmq/instantsend"
|
|
"llmq/signing -> llmq/signing_shares -> llmq/signing"
|
|
"llmq/signing -> net_processing -> llmq/signing"
|
|
"llmq/signing_shares -> net_processing -> llmq/signing_shares"
|
|
"logging -> util/system -> logging"
|
|
"masternode/payments -> validation -> masternode/payments"
|
|
"masternode/sync -> validation -> masternode/sync"
|
|
"net -> netmessagemaker -> net"
|
|
"net_processing -> spork -> net_processing"
|
|
"netaddress -> netbase -> netaddress"
|
|
"qt/appearancewidget -> qt/guiutil -> qt/appearancewidget"
|
|
"qt/bitcoinaddressvalidator -> qt/guiutil -> qt/bitcoinaddressvalidator"
|
|
"qt/bitcoingui -> qt/guiutil -> qt/bitcoingui"
|
|
"qt/guiutil -> qt/optionsdialog -> qt/guiutil"
|
|
"qt/guiutil -> qt/qvalidatedlineedit -> qt/guiutil"
|
|
"core_io -> evo/cbtx -> evo/simplifiedmns -> core_io"
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns"
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler -> llmq/dkgsession"
|
|
"logging -> util/system -> sync -> logging"
|
|
"logging -> util/system -> stacktraces -> logging"
|
|
"logging -> util/system -> util/getuniquepath -> random -> logging"
|
|
"coinjoin/client -> coinjoin/util -> wallet/wallet -> coinjoin/client"
|
|
"coinjoin/client -> net_processing -> coinjoin/context -> coinjoin/client"
|
|
"coinjoin/context -> coinjoin/server -> net_processing -> coinjoin/context"
|
|
"qt/appearancewidget -> qt/guiutil -> qt/optionsdialog -> qt/appearancewidget"
|
|
"qt/guiutil -> qt/optionsdialog -> qt/optionsmodel -> qt/guiutil"
|
|
|
|
"bloom -> evo/assetlocktx -> llmq/quorums -> net -> bloom"
|
|
"banman -> bloom -> evo/assetlocktx -> llmq/quorums -> net -> banman"
|
|
"banman -> bloom -> evo/assetlocktx -> llmq/quorums -> net_processing -> banman"
|
|
"bloom -> evo/assetlocktx -> llmq/quorums -> net_processing -> merkleblock -> bloom"
|
|
|
|
"coinjoin/client -> net_processing -> coinjoin/client"
|
|
"llmq/quorums -> net_processing -> llmq/quorums"
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsession"
|
|
"llmq/chainlocks -> validation -> llmq/chainlocks"
|
|
"coinjoin/coinjoin -> llmq/chainlocks -> net -> coinjoin/coinjoin"
|
|
"evo/deterministicmns -> llmq/utils -> net -> evo/deterministicmns"
|
|
"policy/policy -> policy/settings -> policy/policy"
|
|
"evo/specialtxman -> validation -> evo/specialtxman"
|
|
"consensus/tx_verify -> evo/assetlocktx -> validation -> consensus/tx_verify"
|
|
"consensus/tx_verify -> evo/assetlocktx -> llmq/quorums -> net_processing -> txmempool -> consensus/tx_verify"
|
|
"evo/assetlocktx -> llmq/quorums -> net_processing -> txmempool -> evo/assetlocktx"
|
|
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> llmq/snapshot -> evo/simplifiedmns"
|
|
"llmq/blockprocessor -> net_processing -> llmq/context -> llmq/blockprocessor"
|
|
"llmq/blockprocessor -> net_processing -> llmq/snapshot -> llmq/blockprocessor"
|
|
"llmq/chainlocks -> net_processing -> llmq/context -> llmq/chainlocks"
|
|
"llmq/context -> llmq/dkgsessionmgr -> net_processing -> llmq/context"
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/quorums -> llmq/dkgsession"
|
|
"llmq/dkgsessionmgr -> llmq/quorums -> llmq/dkgsessionmgr"
|
|
"llmq/snapshot -> llmq/utils -> llmq/snapshot"
|
|
"spork -> validation -> spork"
|
|
"governance/governance -> validation -> governance/governance"
|
|
"evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns"
|
|
"governance/object -> validationinterface -> governance/object"
|
|
"governance/vote -> validation -> validationinterface -> governance/vote"
|
|
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
|
|
"llmq/utils -> validation -> llmq/utils"
|
|
"evo/mnhftx -> validation -> evo/mnhftx"
|
|
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
|
)
|
|
|
|
EXIT_CODE=0
|
|
|
|
CIRCULAR_DEPENDENCIES=()
|
|
|
|
IFS=$'\n'
|
|
for CIRC in $(cd src && ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp} | sed -e 's/^Circular dependency: //'); do
|
|
CIRCULAR_DEPENDENCIES+=( "$CIRC" )
|
|
IS_EXPECTED_CIRC=0
|
|
for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do
|
|
if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then
|
|
IS_EXPECTED_CIRC=1
|
|
break
|
|
fi
|
|
done
|
|
if [[ ${IS_EXPECTED_CIRC} == 0 ]]; then
|
|
echo "A new circular dependency in the form of \"${CIRC}\" appears to have been introduced."
|
|
echo
|
|
EXIT_CODE=1
|
|
fi
|
|
done
|
|
|
|
for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do
|
|
IS_PRESENT_EXPECTED_CIRC=0
|
|
for CIRC in "${CIRCULAR_DEPENDENCIES[@]}"; do
|
|
if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then
|
|
IS_PRESENT_EXPECTED_CIRC=1
|
|
break
|
|
fi
|
|
done
|
|
if [[ ${IS_PRESENT_EXPECTED_CIRC} == 0 ]]; then
|
|
echo "Good job! The circular dependency \"${EXPECTED_CIRC}\" is no longer present."
|
|
echo "Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in $0"
|
|
echo "to make sure this circular dependency is not accidentally reintroduced."
|
|
echo
|
|
EXIT_CODE=1
|
|
fi
|
|
done
|
|
|
|
exit ${EXIT_CODE}
|