Skip to content

Commit

Permalink
refactor: change transaction mod name (tari-project#3652)
Browse files Browse the repository at this point in the history
Description
---
Move transaction structs from `transaction_entities` to `transaction`

Motivation and Context
---
In a previous PR, these were moved from the single file `transaction` to `transaction_entities`. This was helpful but makes merging existing feature branches difficult. To make merges simpler, I have changed the name to `transaction` as a smaller step so that merges are less difficult.

How Has This Been Tested?
---
cargo test
  • Loading branch information
stringhandler authored Dec 8, 2021
1 parent 2adf81f commit e4bace6
Show file tree
Hide file tree
Showing 125 changed files with 156 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use std::convert::TryFrom;

use tari_core::transactions::transaction_entities::{OutputFeatures, OutputFlags};
use tari_core::transactions::transaction::{OutputFeatures, OutputFlags};

use crate::tari_rpc as grpc;

Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_grpc/src/conversions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::convert::{TryFrom, TryInto};
use tari_common_types::transaction::{self as tx, TxId};
use tari_core::{
crypto::{ristretto::RistrettoSecretKey, tari_utilities::ByteArray},
transactions::transaction_entities::Transaction,
transactions::transaction::Transaction,
};

use crate::tari_rpc as grpc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use std::convert::{TryFrom, TryInto};

use tari_common_types::types::{Commitment, PublicKey};
use tari_core::transactions::transaction_entities::TransactionInput;
use tari_core::transactions::transaction::TransactionInput;
use tari_crypto::{
script::{ExecutionStack, TariScript},
tari_utilities::{ByteArray, Hashable},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::convert::{TryFrom, TryInto};
use tari_common_types::types::Commitment;
use tari_core::transactions::{
tari_amount::MicroTari,
transaction_entities::{KernelFeatures, TransactionKernel},
transaction::{KernelFeatures, TransactionKernel},
};
use tari_crypto::tari_utilities::{ByteArray, Hashable};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tari_core::{
script::TariScript,
tari_utilities::{ByteArray, Hashable},
},
transactions::transaction_entities::TransactionOutput,
transactions::transaction::TransactionOutput,
};

use crate::tari_rpc as grpc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tari_core::{
script::{ExecutionStack, TariScript},
tari_utilities::ByteArray,
},
transactions::{tari_amount::MicroTari, transaction_entities::UnblindedOutput},
transactions::{tari_amount::MicroTari, transaction::UnblindedOutput},
};

use crate::tari_rpc as grpc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use tari_core::{
iterators::NonOverlappingIntegerPairIter,
mempool::{service::LocalMempoolService, TxStorageResponse},
proof_of_work::PowAlgorithm,
transactions::transaction_entities::Transaction,
transactions::transaction::Transaction,
};
use tari_crypto::tari_utilities::{message_format::MessageFormat, Hashable};
use tari_p2p::{auto_update::SoftwareUpdaterHandle, services::liveness::LivenessHandle};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use tari_core::{
tari_utilities::hex::Hex,
transactions::{
tari_amount::{uT, MicroTari, Tari},
transaction_entities::{TransactionOutput, UnblindedOutput},
transaction::{TransactionOutput, UnblindedOutput},
},
};
use tari_crypto::{
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_console_wallet/src/automation/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tari_core::{
tari_utilities::hex::HexError,
transactions::{
tari_amount::{MicroTariError, TariConversionError},
transaction_entities::TransactionError,
transaction::TransactionError,
},
};
use tari_wallet::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use tari_common_types::types::{BlockHash, Signature};
use tari_comms::{types::CommsPublicKey, CommsNode};
use tari_core::{
tari_utilities::{hex::Hex, ByteArray},
transactions::{tari_amount::MicroTari, transaction_entities::UnblindedOutput},
transactions::{tari_amount::MicroTari, transaction::UnblindedOutput},
};
use tari_crypto::tari_utilities::Hashable;
use tari_wallet::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::convert::TryFrom;
use tari_app_grpc::tari_rpc as grpc;
use tari_core::{
blocks::NewBlockTemplate,
transactions::transaction_entities::{TransactionKernel, TransactionOutput},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

use crate::error::MmProxyError;
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_stratum_transcoder/src/common/mining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::convert::TryFrom;
use tari_app_grpc::tari_rpc as grpc;
use tari_core::{
blocks::NewBlockTemplate,
transactions::transaction_entities::{TransactionKernel, TransactionOutput},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

use crate::error::StratumTranscoderProxyError;
Expand Down
2 changes: 1 addition & 1 deletion applications/test_faucet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tari_common_types::types::{Commitment, PrivateKey};
use tari_core::transactions::{
tari_amount::{MicroTari, T},
test_helpers,
transaction_entities::{KernelFeatures, OutputFeatures, TransactionKernel, TransactionOutput},
transaction::{KernelFeatures, OutputFeatures, TransactionKernel, TransactionOutput},
CryptoFactories,
};
use tari_crypto::{script, tari_utilities::hex::Hex};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ use tari_common_types::{chain_metadata::ChainMetadata, types::HashOutput};
use crate::{
blocks::{Block, BlockHeader, ChainHeader, HistoricalBlock, NewBlockTemplate},
proof_of_work::Difficulty,
transactions::transaction_entities::{
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

/// API Response enum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use crate::{
consensus::{ConsensusConstants, ConsensusManager},
mempool::{async_mempool, Mempool},
proof_of_work::{Difficulty, PowAlgorithm},
transactions::transaction_entities::transaction_kernel::TransactionKernel,
transactions::transaction::TransactionKernel,
};

const LOG_TARGET: &str = "c::bn::comms_interface::inbound_handler";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ use crate::{
},
blocks::{Block, ChainHeader, HistoricalBlock, NewBlockTemplate},
proof_of_work::PowAlgorithm,
transactions::transaction_entities::{
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

pub type BlockEventSender = broadcast::Sender<Arc<BlockEvent>>;
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/base_node/rpc/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use crate::{
},
types::{Signature as SignatureProto, Transaction as TransactionProto},
},
transactions::transaction_entities::transaction::Transaction,
transactions::transaction::Transaction,
};

const LOG_TARGET: &str = "c::base_node::rpc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use tokio::task;
use crate::{
base_node::{comms_interface::CommsInterfaceError, state_machine_service::states::helpers::BaseNodeRequestError},
chain_storage::{ChainStorageError, MmrTree},
transactions::transaction_entities::error::TransactionError,
transactions::transaction::TransactionError,
validation::ValidationError,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ use crate::{
SyncUtxosRequest,
SyncUtxosResponse,
},
transactions::transaction_entities::{
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transactions::transaction::{TransactionKernel, TransactionOutput},
validation::helpers,
};

Expand Down
8 changes: 1 addition & 7 deletions base_layer/core/src/blocks/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ use crate::{
transactions::{
aggregated_body::AggregateBody,
tari_amount::MicroTari,
transaction_entities::{
error::TransactionError,
transaction::Transaction,
transaction_input::TransactionInput,
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transaction::{Transaction, TransactionError, TransactionInput, TransactionKernel, TransactionOutput},
CryptoFactories,
},
};
Expand Down
8 changes: 1 addition & 7 deletions base_layer/core/src/blocks/genesis_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ use crate::{
transactions::{
aggregated_body::AggregateBody,
tari_amount::MicroTari,
transaction_entities::{
output_features::OutputFeatures,
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
KernelFeatures,
OutputFlags,
},
transaction::{KernelFeatures, OutputFeatures, OutputFlags, TransactionKernel, TransactionOutput},
},
};

Expand Down
5 changes: 1 addition & 4 deletions base_layer/core/src/chain_storage/async_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ use crate::{
common::rolling_vec::RollingVec,
proof_of_work::{PowAlgorithm, TargetDifficultyWindow},
tari_utilities::epoch_time::EpochTime,
transactions::transaction_entities::{
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

const LOG_TARGET: &str = "c::bn::async_db";
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/chain_storage/blockchain_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{
MmrTree,
UtxoMinedInfo,
},
transactions::transaction_entities::{transaction_input::TransactionInput, transaction_kernel::TransactionKernel},
transactions::transaction::{TransactionInput, TransactionKernel},
};

/// Identify behaviour for Blockchain database backends. Implementations must support `Send` and `Sync` so that
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/chain_storage/blockchain_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ use crate::{
consensus::{chain_strength_comparer::ChainStrengthComparer, ConsensusConstants, ConsensusManager},
proof_of_work::{monero_rx::MoneroPowData, PowAlgorithm, TargetDifficultyWindow},
tari_utilities::epoch_time::EpochTime,
transactions::transaction_entities::transaction_kernel::TransactionKernel,
transactions::transaction::TransactionKernel,
validation::{
helpers::calc_median_timestamp,
DifficultyCalculator,
Expand Down
5 changes: 1 addition & 4 deletions base_layer/core/src/chain_storage/db_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ use tari_crypto::tari_utilities::{
use crate::{
blocks::{Block, BlockHeader, BlockHeaderAccumulatedData, ChainBlock, ChainHeader, UpdateBlockAccumulatedData},
chain_storage::{error::ChainStorageError, HorizonData},
transactions::transaction_entities::{
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transactions::transaction::{TransactionKernel, TransactionOutput},
};

#[derive(Debug)]
Expand Down
6 changes: 1 addition & 5 deletions base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ use crate::{
crypto::tari_utilities::hex::to_hex,
transactions::{
aggregated_body::AggregateBody,
transaction_entities::{
transaction_input::TransactionInput,
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
},
transaction::{TransactionInput, TransactionKernel, TransactionOutput},
},
};

Expand Down
6 changes: 1 addition & 5 deletions base_layer/core/src/chain_storage/lmdb_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ pub use lmdb_db::{create_lmdb_database, create_recovery_lmdb_database, LMDBDatab
use serde::{Deserialize, Serialize};
use tari_common_types::types::HashOutput;

use crate::transactions::transaction_entities::{
transaction_input::TransactionInput,
transaction_kernel::TransactionKernel,
transaction_output::TransactionOutput,
};
use crate::transactions::transaction::{TransactionInput, TransactionKernel, TransactionOutput};

mod lmdb;
#[allow(clippy::module_inception)]
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/chain_storage/pruned_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use tari_common_types::types::HashOutput;
use tari_crypto::tari_utilities::Hashable;

use crate::transactions::transaction_entities::transaction_output::TransactionOutput;
use crate::transactions::transaction::TransactionOutput;

#[allow(clippy::large_enum_variant)]
#[derive(Debug, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ use crate::{
transactions::{
tari_amount::T,
test_helpers::{schema_to_transaction, TransactionSchema},
transaction_entities::{
output_features::OutputFeatures,
transaction::Transaction,
unblinded_output::UnblindedOutput,
},
transaction::{OutputFeatures, Transaction, UnblindedOutput},
},
txn_schema,
};
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/consensus/consensus_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::{
NetworkConsensus,
},
proof_of_work::DifficultyAdjustmentError,
transactions::{tari_amount::MicroTari, transaction_entities::transaction_kernel::TransactionKernel},
transactions::{tari_amount::MicroTari, transaction::TransactionKernel},
};

#[derive(Debug, Error)]
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/async_mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tari_common_types::types::Signature;
use crate::{
blocks::Block,
mempool::{error::MempoolError, Mempool, StateResponse, StatsResponse, TxStorageResponse},
transactions::transaction_entities::transaction::Transaction,
transactions::transaction::Transaction,
};

macro_rules! make_async {
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use thiserror::Error;
use crate::{
chain_storage::ChainStorageError,
mempool::{reorg_pool::ReorgPoolError, unconfirmed_pool::UnconfirmedPoolError},
transactions::transaction_entities::error::TransactionError,
transactions::transaction::TransactionError,
};

#[derive(Debug, Error)]
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
StatsResponse,
TxStorageResponse,
},
transactions::transaction_entities::transaction::Transaction,
transactions::transaction::Transaction,
validation::MempoolTransactionValidation,
};

Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/mempool_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::{
StatsResponse,
TxStorageResponse,
},
transactions::{transaction_entities::transaction::Transaction, weight::TransactionWeight},
transactions::{transaction::Transaction, weight::TransactionWeight},
validation::{MempoolTransactionValidation, ValidationError},
};

Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub use sync_protocol::MempoolSyncInitializer;
use tari_common_types::types::Signature;
use tari_crypto::tari_utilities::hex::Hex;

use crate::transactions::transaction_entities::transaction::Transaction;
use crate::transactions::transaction::Transaction;

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StatsResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tari_crypto::tari_utilities::message_format::MessageFormat;

use crate::{
mempool::priority::PriorityError,
transactions::{transaction_entities::transaction::Transaction, weight::TransactionWeight},
transactions::{transaction::Transaction, weight::TransactionWeight},
};

/// Create a unique unspent transaction priority based on the transaction fee, maturity of the oldest input UTXO and the
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/reorg_pool/reorg_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::{
consts::{MEMPOOL_REORG_POOL_CACHE_TTL, MEMPOOL_REORG_POOL_STORAGE_CAPACITY},
reorg_pool::{ReorgPoolError, ReorgPoolStorage},
},
transactions::transaction_entities::transaction::Transaction,
transactions::transaction::Transaction,
};

/// Configuration for the ReorgPool
Expand Down
6 changes: 1 addition & 5 deletions base_layer/core/src/mempool/reorg_pool/reorg_pool_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ use tari_common_types::types::Signature;
use tari_crypto::tari_utilities::hex::Hex;
use ttl_cache::TtlCache;

use crate::{
blocks::Block,
mempool::reorg_pool::reorg_pool::ReorgPoolConfig,
transactions::transaction_entities::transaction::Transaction,
};
use crate::{blocks::Block, mempool::reorg_pool::reorg_pool::ReorgPoolConfig, transactions::transaction::Transaction};

pub const LOG_TARGET: &str = "c::mp::reorg_pool::reorg_pool_storage";

Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/mempool/rpc/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tari_comms::protocol::rpc::{Request, Response, RpcStatus};
use crate::{
mempool::{rpc::MempoolService, service::MempoolHandle},
proto,
transactions::transaction_entities::transaction::Transaction,
transactions::transaction::Transaction,
};

const LOG_TARGET: &str = "c::mempool::rpc";
Expand Down
Loading

0 comments on commit e4bace6

Please sign in to comment.