Skip to content

Commit 428468e

Browse files
author
Seulgi Kim
committed
Move ParcelOutcome to types
1 parent ceb2683 commit 428468e

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

core/src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use ccrypto::BLAKE_NULL_RLP;
2020
use ckey::Address;
2121
use cmerkle::skewed_merkle_root;
2222
use ctypes::invoice::{Invoice, ParcelInvoice};
23-
use ctypes::parcel::Error as ParcelError;
23+
use ctypes::parcel::{Error as ParcelError, Outcome as ParcelOutcome};
2424
use primitives::{Bytes, H256};
2525
use rlp::{Decodable, DecoderError, Encodable, RlpStream, UntrustedRlp};
2626
use trie::TrieFactory;
@@ -31,7 +31,7 @@ use super::error::{BlockError, Error};
3131
use super::header::{Header, Seal};
3232
use super::machine::{LiveBlock, Parcels};
3333
use super::parcel::{SignedParcel, UnverifiedParcel};
34-
use super::state::{ParcelOutcome, StateWithCache, TopLevelState};
34+
use super::state::{StateWithCache, TopLevelState};
3535
use super::state_db::StateDB;
3636

3737
/// A block, encoded as it is on the block chain.

core/src/state/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ pub use self::metadata::{Metadata, MetadataAddress};
5858
pub use self::shard::{Shard, ShardAddress};
5959
pub use self::shard_metadata::{ShardMetadata, ShardMetadataAddress};
6060
pub use self::shard_state::ShardState;
61-
pub use self::top_level::{ParcelOutcome, TopLevelState};
61+
pub use self::top_level::TopLevelState;
6262
pub use self::top_state::TopState;
6363
pub use self::traits::StateWithCache;

core/src/state/top_level.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use std::fmt;
4141
use ccrypto::BLAKE_NULL_RLP;
4242
use ckey::{Address, Public};
4343
use ctypes::invoice::Invoice;
44-
use ctypes::parcel::{Action, ChangeShard, Error as ParcelError};
44+
use ctypes::parcel::{Action, ChangeShard, Error as ParcelError, Outcome as ParcelOutcome};
4545
use ctypes::transaction::{Outcome as TransactionOutcome, Transaction};
4646
use error::Error;
4747
use parcel::SignedParcel;
@@ -63,16 +63,6 @@ use super::shard_state::ShardState;
6363
use super::top_state::TopState;
6464
use super::traits::{CheckpointId, StateWithCache, StateWithCheckpoint};
6565

66-
/// Used to return information about an `State::apply` operation.
67-
#[derive(Debug, PartialEq)]
68-
pub enum ParcelOutcome {
69-
Single {
70-
invoice: Invoice,
71-
error: Option<ParcelError>,
72-
},
73-
Transactions(Vec<TransactionOutcome>),
74-
}
75-
7666
/// Representation of the entire state of all accounts in the system.
7767
///
7868
/// `State` can work together with `StateDB` to share account cache.

types/src/parcel/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
mod action;
1818
mod error;
19+
mod outcome;
1920
mod parcel;
2021

2122
pub use self::action::{Action, ChangeShard};
2223
pub use self::error::Error;
24+
pub use self::outcome::Outcome;
2325
pub use self::parcel::Parcel;

types/src/parcel/outcome.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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::super::transaction::Outcome as TransactionOutcome;
19+
use super::Error;
20+
21+
#[derive(Debug, PartialEq)]
22+
pub enum Outcome {
23+
Single {
24+
invoice: Invoice,
25+
error: Option<Error>,
26+
},
27+
Transactions(Vec<TransactionOutcome>),
28+
}

0 commit comments

Comments
 (0)