mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
Merge bitcoin/bitcoin#28922: Use Txid in COutpoint
9e58c5bcd9Use Txid in COutpoint (dergoegge) Pull request description: This PR changes the type of the hash of a transaction outpoint from `uint256` to `Txid`. ACKs for top commit: Sjors: ACK9e58c5bcd9stickies-v: ACK9e58c5bcd9. A sizeable diff, but very straightforward changes. Didn't see anything controversial. Left a few nits, but nothing blocking, only if you have to retouch. TheCharlatan: ACK9e58c5bcd9Tree-SHA512: 58f61ce1c58668f689513e62072a7775419c4d5af8f607669cd8cdc2e7be9645ba14af7f9e2d65da2670da3ec1ce7fc2a744037520caf799aba212fd1ac44b34
This commit is contained in:
@@ -28,7 +28,7 @@ struct ReorgTxns {
|
||||
static BlockTxns CreateRandomTransactions(size_t num_txns)
|
||||
{
|
||||
// Ensure every transaction has a different txid by having each one spend the previous one.
|
||||
static uint256 prevout_hash{uint256::ZERO};
|
||||
static Txid prevout_hash{};
|
||||
|
||||
BlockTxns txns;
|
||||
txns.reserve(num_txns);
|
||||
|
||||
@@ -47,7 +47,7 @@ static void DuplicateInputs(benchmark::Bench& bench)
|
||||
|
||||
uint64_t n_inputs = (((MAX_BLOCK_SERIALIZED_SIZE / WITNESS_SCALE_FACTOR) - (CTransaction(coinbaseTx).GetTotalSize() + CTransaction(naughtyTx).GetTotalSize())) / 41) - 100;
|
||||
for (uint64_t x = 0; x < (n_inputs - 1); ++x) {
|
||||
naughtyTx.vin.emplace_back(GetRandHash(), 0, CScript(), 0);
|
||||
naughtyTx.vin.emplace_back(Txid::FromUint256(GetRandHash()), 0, CScript(), 0);
|
||||
}
|
||||
naughtyTx.vin.emplace_back(naughtyTx.vin.back());
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static std::vector<CTransactionRef> CreateOrderedCoins(FastRandomContext& det_ra
|
||||
for (size_t ancestor = 0; ancestor < n_ancestors && !available_coins.empty(); ++ancestor){
|
||||
size_t idx = det_rand.randrange(available_coins.size());
|
||||
Available coin = available_coins[idx];
|
||||
uint256 hash = coin.ref->GetHash();
|
||||
Txid hash = coin.ref->GetHash();
|
||||
// biased towards taking min_ancestors parents, but maybe more
|
||||
size_t n_to_take = det_rand.randrange(2) == 0 ?
|
||||
min_ancestors :
|
||||
|
||||
Reference in New Issue
Block a user