Skip to content

Commit 09ffd54

Browse files
authored
Utxo crate cleanup (#353)
1 parent 845443b commit 09ffd54

File tree

22 files changed

+1077
-955
lines changed

22 files changed

+1077
-955
lines changed

chainstate-storage/src/internal/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ use common::{
2626
};
2727
use serialization::{Codec, Decode, DecodeAll, Encode};
2828
use storage::traits::{self, MapMut, MapRef, TransactionRo, TransactionRw};
29-
use utxo::{
30-
utxo_storage::{UtxosStorageRead, UtxosStorageWrite},
31-
BlockUndo, Utxo,
32-
};
29+
use utxo::{BlockUndo, Utxo, UtxosStorageRead, UtxosStorageWrite};
3330

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

chainstate-storage/src/internal/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn create_rand_utxo(rng: &mut impl Rng, block_height: u64) -> Utxo {
265265
let is_block_reward = random_value % 3 == 0;
266266

267267
// generate utxo
268-
Utxo::new(output, is_block_reward, BlockHeight::new(block_height))
268+
Utxo::new_for_blockchain(output, is_block_reward, BlockHeight::new(block_height))
269269
}
270270

271271
/// returns a block undo with random utxos and TxUndos.

chainstate-storage/src/internal/utxo_db.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ mod test {
2323
use crypto::random::Rng;
2424
use rstest::rstest;
2525
use test_utils::random::{make_seedable_rng, Seed};
26-
use utxo::utxo_storage::UtxosDBMut;
27-
use utxo::utxo_storage::{UtxosStorageRead, UtxosStorageWrite};
28-
use utxo::Utxo;
26+
use utxo::{Utxo, UtxosDBMut, UtxosStorageRead, UtxosStorageWrite};
2927

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

3937
// create the id based on the `is_block_reward` value.
4038
let id = OutPointSourceId::BlockReward(Id::new(H256::random()));

chainstate-storage/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use common::chain::OutPointSourceId;
2222
use common::chain::{Block, GenBlock};
2323
use common::primitives::{BlockHeight, Id};
2424
use storage::traits;
25-
use utxo::utxo_storage::{UtxosStorageRead, UtxosStorageWrite};
25+
use utxo::{UtxosStorageRead, UtxosStorageWrite};
2626

2727
mod internal;
2828
#[cfg(any(test, feature = "mock"))]

chainstate-storage/src/mock.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ use common::{
2424
},
2525
primitives::{BlockHeight, Id},
2626
};
27-
use utxo::{
28-
utxo_storage::{UtxosStorageRead, UtxosStorageWrite},
29-
BlockUndo, Utxo,
30-
};
27+
use utxo::{BlockUndo, Utxo, UtxosStorageRead, UtxosStorageWrite};
3128

3229
mockall::mock! {
3330
/// A mock object for blockchain storage

chainstate/src/detail/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use common::{
4242
};
4343
use logging::log;
4444
use utils::eventhandler::{EventHandler, EventsController};
45-
use utxo::utxo_storage::UtxosDBMut;
45+
use utxo::UtxosDBMut;
4646

4747
use self::{
4848
orphan_blocks::{OrphanBlocksRef, OrphanBlocksRefMut},

0 commit comments

Comments
 (0)