Skip to content

Utxo crate cleanup #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions chainstate-storage/src/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ use common::{
};
use serialization::{Codec, Decode, DecodeAll, Encode};
use storage::traits::{self, MapMut, MapRef, TransactionRo, TransactionRw};
use utxo::{
utxo_storage::{UtxosStorageRead, UtxosStorageWrite},
BlockUndo, Utxo,
};
use utxo::{BlockUndo, Utxo, UtxosStorageRead, UtxosStorageWrite};

use crate::{BlockchainStorage, BlockchainStorageRead, BlockchainStorageWrite, Transactional};

Expand Down
2 changes: 1 addition & 1 deletion chainstate-storage/src/internal/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn create_rand_utxo(rng: &mut impl Rng, block_height: u64) -> Utxo {
let is_block_reward = random_value % 3 == 0;

// generate utxo
Utxo::new(output, is_block_reward, BlockHeight::new(block_height))
Utxo::new_for_blockchain(output, is_block_reward, BlockHeight::new(block_height))
}

/// returns a block undo with random utxos and TxUndos.
Expand Down
6 changes: 2 additions & 4 deletions chainstate-storage/src/internal/utxo_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ mod test {
use crypto::random::Rng;
use rstest::rstest;
use test_utils::random::{make_seedable_rng, Seed};
use utxo::utxo_storage::UtxosDBMut;
use utxo::utxo_storage::{UtxosStorageRead, UtxosStorageWrite};
use utxo::Utxo;
use utxo::{Utxo, UtxosDBMut, UtxosStorageRead, UtxosStorageWrite};

fn create_utxo(block_height: u64, output_value: u128) -> (Utxo, OutPoint) {
// just a random value generated, and also a random `is_block_reward` value.
Expand All @@ -34,7 +32,7 @@ mod test {
OutputValue::Coin(Amount::from_atoms(output_value)),
OutputPurpose::Transfer(Destination::PublicKey(pub_key)),
);
let utxo = Utxo::new(output, true, BlockHeight::new(block_height));
let utxo = Utxo::new_for_blockchain(output, true, BlockHeight::new(block_height));

// create the id based on the `is_block_reward` value.
let id = OutPointSourceId::BlockReward(Id::new(H256::random()));
Expand Down
2 changes: 1 addition & 1 deletion chainstate-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use common::chain::OutPointSourceId;
use common::chain::{Block, GenBlock};
use common::primitives::{BlockHeight, Id};
use storage::traits;
use utxo::utxo_storage::{UtxosStorageRead, UtxosStorageWrite};
use utxo::{UtxosStorageRead, UtxosStorageWrite};

mod internal;
#[cfg(any(test, feature = "mock"))]
Expand Down
5 changes: 1 addition & 4 deletions chainstate-storage/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ use common::{
},
primitives::{BlockHeight, Id},
};
use utxo::{
utxo_storage::{UtxosStorageRead, UtxosStorageWrite},
BlockUndo, Utxo,
};
use utxo::{BlockUndo, Utxo, UtxosStorageRead, UtxosStorageWrite};

mockall::mock! {
/// A mock object for blockchain storage
Expand Down
2 changes: 1 addition & 1 deletion chainstate/src/detail/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use common::{
};
use logging::log;
use utils::eventhandler::{EventHandler, EventsController};
use utxo::utxo_storage::UtxosDBMut;
use utxo::UtxosDBMut;

use self::{
orphan_blocks::{OrphanBlocksRef, OrphanBlocksRefMut},
Expand Down
Loading