mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 10:42:23 +02:00
scripted-diff: remove Optional & nullopt
-BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src) sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src) sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src) sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e '/optional.h \\/d' src/Makefile.am sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src) -END VERIFY SCRIPT-
This commit is contained in:
@ -65,7 +65,7 @@ static uint256 ComputeModifiedMerkleRoot(const CMutableTransaction& cb, const CB
|
||||
return ComputeMerkleRoot(std::move(leaves));
|
||||
}
|
||||
|
||||
Optional<SignetTxs> SignetTxs::Create(const CBlock& block, const CScript& challenge)
|
||||
std::optional<SignetTxs> SignetTxs::Create(const CBlock& block, const CScript& challenge)
|
||||
{
|
||||
CMutableTransaction tx_to_spend;
|
||||
tx_to_spend.nVersion = 0;
|
||||
@ -83,12 +83,12 @@ Optional<SignetTxs> SignetTxs::Create(const CBlock& block, const CScript& challe
|
||||
// responses from block coinbase tx
|
||||
|
||||
// find and delete signet signature
|
||||
if (block.vtx.empty()) return nullopt; // no coinbase tx in block; invalid
|
||||
if (block.vtx.empty()) return std::nullopt; // no coinbase tx in block; invalid
|
||||
CMutableTransaction modified_cb(*block.vtx.at(0));
|
||||
|
||||
const int cidx = GetWitnessCommitmentIndex(block);
|
||||
if (cidx == NO_WITNESS_COMMITMENT) {
|
||||
return nullopt; // require a witness commitment
|
||||
return std::nullopt; // require a witness commitment
|
||||
}
|
||||
|
||||
CScript& witness_commitment = modified_cb.vout.at(cidx).scriptPubKey;
|
||||
@ -101,9 +101,9 @@ Optional<SignetTxs> SignetTxs::Create(const CBlock& block, const CScript& challe
|
||||
VectorReader v(SER_NETWORK, INIT_PROTO_VERSION, signet_solution, 0);
|
||||
v >> tx_spending.vin[0].scriptSig;
|
||||
v >> tx_spending.vin[0].scriptWitness.stack;
|
||||
if (!v.empty()) return nullopt; // extraneous data encountered
|
||||
if (!v.empty()) return std::nullopt; // extraneous data encountered
|
||||
} catch (const std::exception&) {
|
||||
return nullopt; // parsing error
|
||||
return std::nullopt; // parsing error
|
||||
}
|
||||
}
|
||||
uint256 signet_merkle = ComputeModifiedMerkleRoot(modified_cb, block);
|
||||
@ -129,7 +129,7 @@ bool CheckSignetBlockSolution(const CBlock& block, const Consensus::Params& cons
|
||||
}
|
||||
|
||||
const CScript challenge(consensusParams.signet_challenge.begin(), consensusParams.signet_challenge.end());
|
||||
const Optional<SignetTxs> signet_txs = SignetTxs::Create(block, challenge);
|
||||
const std::optional<SignetTxs> signet_txs = SignetTxs::Create(block, challenge);
|
||||
|
||||
if (!signet_txs) {
|
||||
LogPrint(BCLog::VALIDATION, "CheckSignetBlockSolution: Errors in block (block solution parse failure)\n");
|
||||
|
Reference in New Issue
Block a user