Clarify indexes in `new_ordered_outputs` (#2510)
This commit is contained in:
parent
170e343905
commit
6df17ff78c
|
|
@ -1,6 +1,6 @@
|
||||||
//! Unspent transparent output data structures and functions.
|
//! Unspent transparent output data structures and functions.
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::{collections::HashMap, convert::TryInto};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
block::{self, Block},
|
block::{self, Block},
|
||||||
|
|
@ -102,10 +102,17 @@ pub fn new_ordered_outputs(
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
let from_coinbase = transaction.is_coinbase();
|
let from_coinbase = transaction.is_coinbase();
|
||||||
for (index, output) in transaction.outputs().iter().cloned().enumerate() {
|
for (output_index_in_transaction, output) in
|
||||||
let index = index as u32;
|
transaction.outputs().iter().cloned().enumerate()
|
||||||
|
{
|
||||||
|
let output_index_in_transaction = output_index_in_transaction
|
||||||
|
.try_into()
|
||||||
|
.expect("unexpectedly large number of outputs");
|
||||||
new_ordered_outputs.insert(
|
new_ordered_outputs.insert(
|
||||||
transparent::OutPoint { hash, index },
|
transparent::OutPoint {
|
||||||
|
hash,
|
||||||
|
index: output_index_in_transaction,
|
||||||
|
},
|
||||||
OrderedUtxo::new(output, height, from_coinbase, tx_index_in_block),
|
OrderedUtxo::new(output, height, from_coinbase, tx_index_in_block),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue