Skip to content

Commit ceb2683

Browse files
author
Seulgi Kim
committed
Move TransactionOutcome to types
1 parent 2c9fd15 commit ceb2683

File tree

6 files changed

+35
-15
lines changed

6 files changed

+35
-15
lines changed

core/src/state/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub use self::info::{ShardStateInfo, TopStateInfo};
5757
pub use self::metadata::{Metadata, MetadataAddress};
5858
pub use self::shard::{Shard, ShardAddress};
5959
pub use self::shard_metadata::{ShardMetadata, ShardMetadataAddress};
60-
pub use self::shard_state::{ShardState, TransactionOutcome};
60+
pub use self::shard_state::ShardState;
6161
pub use self::top_level::{ParcelOutcome, TopLevelState};
6262
pub use self::top_state::TopState;
6363
pub use self::traits::StateWithCache;

core/src/state/shard_level.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use ccrypto::{Blake, BLAKE_NULL_RLP};
2222
use ckey::Address;
2323
use ctypes::invoice::Invoice;
2424
use ctypes::transaction::{
25-
AssetMintOutput, AssetTransferInput, AssetTransferOutput, Error as TransactionError, Transaction,
25+
AssetMintOutput, AssetTransferInput, AssetTransferOutput, Error as TransactionError, Outcome as TransactionOutcome,
26+
Transaction,
2627
};
2728
use cvm::{decode, execute, ScriptResult, VMConfig};
2829
use error::Error;
@@ -36,7 +37,7 @@ use super::cache::Cache;
3637
use super::traits::{CheckpointId, StateWithCache, StateWithCheckpoint};
3738
use super::{
3839
Asset, AssetAddress, AssetScheme, AssetSchemeAddress, Backend, ShardBackend, ShardMetadata, ShardMetadataAddress,
39-
ShardState, ShardStateInfo, TransactionOutcome,
40+
ShardState, ShardStateInfo,
4041
};
4142

4243
pub struct ShardLevelState<B> {

core/src/state/shard_state.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use ctypes::transaction::{Error as TransactionError, Transaction};
17+
use ctypes::transaction::{Outcome as TransactionOutcome, Transaction};
1818

19-
use ctypes::invoice::Invoice;
2019
use error::Error;
2120

2221
use super::ShardBackend;
@@ -26,11 +25,3 @@ where
2625
B: ShardBackend, {
2726
fn apply(&mut self, transaction: &Transaction, parcel_network_id: &u64) -> Result<TransactionOutcome, Error>;
2827
}
29-
30-
#[derive(Debug, PartialEq)]
31-
pub struct TransactionOutcome {
32-
/// The invoice for the applied parcel.
33-
pub invoice: Invoice,
34-
/// The output of the applied parcel.
35-
pub error: Option<TransactionError>,
36-
}

core/src/state/top_level.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use ccrypto::BLAKE_NULL_RLP;
4242
use ckey::{Address, Public};
4343
use ctypes::invoice::Invoice;
4444
use ctypes::parcel::{Action, ChangeShard, Error as ParcelError};
45-
use ctypes::transaction::Transaction;
45+
use ctypes::transaction::{Outcome as TransactionOutcome, Transaction};
4646
use error::Error;
4747
use parcel::SignedParcel;
4848
use primitives::{H256, U256};
@@ -59,7 +59,7 @@ use super::info::{ShardStateInfo, TopStateInfo};
5959
use super::metadata::{Metadata, MetadataAddress};
6060
use super::shard::{Shard, ShardAddress};
6161
use super::shard_level::ShardLevelState;
62-
use super::shard_state::{ShardState, TransactionOutcome};
62+
use super::shard_state::ShardState;
6363
use super::top_state::TopState;
6464
use super::traits::{CheckpointId, StateWithCache, StateWithCheckpoint};
6565

types/src/transaction/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
mod error;
18+
mod outcome;
1819
mod transaction;
1920

2021
pub use self::error::Error;
22+
pub use self::outcome::Outcome;
2123
pub use self::transaction::{AssetMintOutput, AssetOutPoint, AssetTransferInput, AssetTransferOutput, Transaction};

types/src/transaction/outcome.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2018 Kodebox, Inc.
2+
// This file is part of CodeChain.
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as
6+
// published by the Free Software Foundation, either version 3 of the
7+
// License, or (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
use super::super::invoice::Invoice;
18+
use super::Error;
19+
20+
#[derive(Debug, PartialEq)]
21+
pub struct Outcome {
22+
/// The invoice for the applied parcel.
23+
pub invoice: Invoice,
24+
/// The output of the applied parcel.
25+
pub error: Option<Error>,
26+
}

0 commit comments

Comments
 (0)