mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #17080: consensus: Explain why fCheckDuplicateInputs can not be skipped and remove it
fa92813407consensus: Explain why fCheckDuplicateInputs can not be skipped and remove it (MarcoFalke) Pull request description: As a follow up to CVE-2018-17144, this removes the unused `fCheckDuplicateInputs` parameter and explains why the test can not be disabled. Apart from protecting against a dumb accident in the future, this should document the logic in the code. There is a technical write-up that explains how the underlying coins database behaves if this test is skipped: https://bitcoincore.org/en/2018/09/20/notice/#technical-details. However, it does not explicitly mention why the test can not be skipped. I hope my code comment does that. ACKs for top commit: jnewbery: ACKfa92813407amitiuttarwar: utACKfa92813407Empact: Code review ACKfa92813407promag: ACKfa92813407. Tree-SHA512: fc1ef670f1a467c543b84f704b9bd8cc7a59a9f707be048bd9b4e85fe70830702aa560a880efa2c840bb43818ab44dfdc611104df04db2ddc14ff92f46bfb28e
This commit is contained in:
@@ -43,12 +43,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
}
|
||||
|
||||
CValidationState state_with_dupe_check;
|
||||
const bool valid_with_dupe_check = CheckTransaction(tx, state_with_dupe_check, /* fCheckDuplicateInputs= */ true);
|
||||
CValidationState state_without_dupe_check;
|
||||
const bool valid_without_dupe_check = CheckTransaction(tx, state_without_dupe_check, /* fCheckDuplicateInputs= */ false);
|
||||
if (valid_with_dupe_check) {
|
||||
assert(valid_without_dupe_check);
|
||||
}
|
||||
(void)CheckTransaction(tx, state_with_dupe_check);
|
||||
|
||||
const CFeeRate dust_relay_fee{DUST_RELAY_TX_FEE};
|
||||
std::string reason;
|
||||
|
||||
Reference in New Issue
Block a user