Skip to content

Commit 29f8fa8

Browse files
authored
remove marketplace as features (#60)
* remove marketplace as features * remove serialize
1 parent b246256 commit 29f8fa8

File tree

10 files changed

+8
-48
lines changed

10 files changed

+8
-48
lines changed

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,3 @@ built = { version = "0.4", features = ["git2"]}
5454
[dev-dependencies]
5555
grin_chain = { path = "./chain", version = "4.4.2" }
5656
grin_store = { path = "./store", version = "4.4.2" }
57-
58-
59-
[features]
60-
marketplace = ["grin_p2p/marketplace", "grin_api/marketplace", "grin_servers/marketplace"]

api/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,3 @@ hyper-rustls = "0.20"
4545

4646
[target.'cfg(target_os = "android")'.dependencies]
4747
hyper-rustls = { version = "0.21", default-features = false, features = ["webpki-tokio"] }
48-
49-
[features]
50-
marketplace = ["grin_p2p/marketplace"]

api/src/foreign.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ use crate::types::{
3131
Version,
3232
};
3333
use crate::util::RwLock;
34-
#[cfg(feature = "marketplace")]
3534
use crate::{Libp2pMessages, Libp2pPeers};
36-
#[cfg(feature = "marketplace")]
3735
use chrono::Utc;
38-
#[cfg(feature = "marketplace")]
3936
use grin_p2p::libp2p_connection;
4037
use std::sync::Weak;
4138

@@ -373,7 +370,6 @@ where
373370
}
374371
}
375372

376-
#[cfg(feature = "marketplace")]
377373
/// Get TOR address on this node. Return none if TOR is not running.
378374
pub fn get_libp2p_peers(&self) -> Result<Libp2pPeers, Error> {
379375
//get_server_onion_address()
@@ -399,7 +395,7 @@ where
399395
node_peers,
400396
})
401397
}
402-
#[cfg(feature = "marketplace")]
398+
403399
pub fn get_libp2p_messages(&self) -> Result<Libp2pMessages, Error> {
404400
Ok(Libp2pMessages {
405401
current_time: Utc::now().timestamp(),

api/src/foreign_rpc.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ use crate::types::{
2525
BlockHeaderPrintable, BlockPrintable, LocatedTxKernel, OutputListing, OutputPrintable, Tip,
2626
Version,
2727
};
28-
use crate::util;
29-
#[cfg(feature = "marketplace")]
30-
use crate::{Libp2pMessages, Libp2pPeers};
28+
29+
use crate::{util, Libp2pMessages, Libp2pPeers};
3130

3231
/// Public definition used to generate Node jsonrpc api.
3332
/// * When running `grin` with defaults, the V2 api is available at
@@ -863,7 +862,7 @@ pub trait ForeignRpc: Sync + Send {
863862
```
864863
*/
865864
fn push_transaction(&self, tx: Transaction, fluff: Option<bool>) -> Result<(), ErrorKind>;
866-
/*
865+
867866
/**
868867
Networked version of [Owner::get_libp2p_peers](struct.Owner.html#method.get_libp2p_peers).
869868
@@ -895,17 +894,14 @@ pub trait ForeignRpc: Sync + Send {
895894
# );
896895
```
897896
*/
898-
#[cfg(feature = "marketplace")]
899897
fn get_libp2p_peers(&self) -> Result<Libp2pPeers, ErrorKind>;
900898

901-
902899
/**
903900
Networked version of [Owner::get_libp2p_messages](struct.Owner.html#method.get_libp2p_messages).
904901
905902
// No example because if current time dynamic nature.
906903
*/
907904
fn get_libp2p_messages(&self) -> Result<Libp2pMessages, ErrorKind>;
908-
*/
909905
}
910906

911907
impl<B, P, V> ForeignRpc for Foreign<B, P, V>
@@ -1032,16 +1028,12 @@ where
10321028
fn push_transaction(&self, tx: Transaction, fluff: Option<bool>) -> Result<(), ErrorKind> {
10331029
Foreign::push_transaction(self, tx, fluff).map_err(|e| e.kind().clone())
10341030
}
1035-
/*
1036-
#[cfg(feature = "marketplace")]
10371031
fn get_libp2p_peers(&self) -> Result<Libp2pPeers, ErrorKind> {
10381032
Foreign::get_libp2p_peers(self).map_err(|e| e.kind().clone())
10391033
}
1040-
#[cfg(feature = "marketplace")]
10411034
fn get_libp2p_messages(&self) -> Result<Libp2pMessages, ErrorKind> {
10421035
Foreign::get_libp2p_messages(self).map_err(|e| e.kind().clone())
10431036
}
1044-
*/
10451037
}
10461038

10471039
#[doc(hidden)]

api/src/types.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use crate::core::{core, ser};
2020
use crate::p2p;
2121
use crate::util::secp::pedersen;
2222
use crate::util::{self, ToHex};
23-
#[cfg(feature = "marketplace")]
2423
use grin_p2p::libp2p_connection;
2524
use serde;
2625
use serde::de::MapAccess;
@@ -774,7 +773,7 @@ pub struct Libp2pPeers {
774773
/// Other nodes. There is a high chance that they are running libp2p network
775774
pub node_peers: Vec<String>,
776775
}
777-
#[cfg(feature = "marketplace")]
776+
778777
/// Libp2p message from this node
779778
#[derive(Debug, Serialize, Deserialize, Clone)]
780779
pub struct Libp2pMessages {

p2p/Cargo.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ chrono = { version = "0.4.11", features = ["serde"] }
2828
futures = "0.3"
2929
#libp2p-tokio-socks5 = { path = "../../rust-libp2p-tokio-socks5" }
3030
#libp2p = { path = "../../rust-libp2p", default-features = false, features = [ "noise", "yamux", "mplex", "dns", "tcp-tokio", "ping", "gossipsub"] }
31-
libp2p-tokio-socks5 = { git = "https://github.com/mwcproject/rust-libp2p-tokio-socks5", branch = "master", optional = true}
32-
libp2p = { git = "https://github.com/mwcproject/rust-libp2p", branch = "master", default-features = false, features = [ "noise", "yamux", "mplex", "dns", "tcp-tokio", "ping", "gossipsub"], optional = true}
31+
libp2p-tokio-socks5 = { git = "https://github.com/mwcproject/rust-libp2p-tokio-socks5", branch = "master"}
32+
libp2p = { git = "https://github.com/mwcproject/rust-libp2p", branch = "master", default-features = false, features = [ "noise", "yamux", "mplex", "dns", "tcp-tokio", "ping", "gossipsub"]}
3333
lazy_static = "1"
3434
async-std = "1.9"
3535
tokio = {version = "0.2", features = ["full"] }
@@ -42,8 +42,4 @@ grin_util = { path = "../util", version = "4.4.2" }
4242
grin_chain = { path = "../chain", version = "4.4.2" }
4343

4444
[dev-dependencies]
45-
grin_pool = { path = "../pool", version = "4.4.2" }
46-
47-
48-
[features]
49-
marketplace = ["libp2p-tokio-socks5", "libp2p"]
45+
grin_pool = { path = "../pool", version = "4.4.2" }

p2p/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ extern crate lazy_static;
4141

4242
mod conn;
4343
pub mod handshake;
44-
#[cfg(feature = "marketplace")]
4544
pub mod libp2p_connection;
4645
pub mod msg;
4746
mod peer;
@@ -61,7 +60,6 @@ pub use crate::types::{
6160
Seeding, TxHashSetRead, MAX_BLOCK_HEADERS, MAX_LOCATORS, MAX_PEER_ADDRS,
6261
};
6362

64-
#[cfg(feature = "marketplace")]
6563
pub use crate::libp2p_connection::{
6664
add_new_peer, build_integrity_message, get_libp2p_connections, read_message_data,
6765
run_libp2p_node, set_seed_list,

servers/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,3 @@ hyper-rustls = "0.20"
4848

4949
[target.'cfg(target_os = "android")'.dependencies]
5050
hyper-rustls = { version = "0.21", default-features = false, features = ["webpki-tokio"] }
51-
52-
[features]
53-
marketplace = ["grin_p2p/marketplace", "grin_api/marketplace"]

servers/src/grin/seed.rs

-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use std::{cmp, thread, time};
3030
use crate::core::global;
3131
use crate::core::global::{FLOONET_DNS_SEEDS, MAINNET_DNS_SEEDS};
3232
use crate::p2p;
33-
#[cfg(feature = "marketplace")]
3433
use crate::p2p::libp2p_connection;
3534
use crate::p2p::types::PeerAddr;
3635
use crate::p2p::ChainAdapter;
@@ -65,7 +64,6 @@ pub fn connect_and_monitor(
6564
&preferred_peers,
6665
);
6766

68-
#[cfg(feature = "marketplace")]
6967
libp2p_connection::set_seed_list(&seed_list, true);
7068

7169
let mut prev = MIN_DATE.and_hms(0, 0, 0);
@@ -392,7 +390,6 @@ fn listen_for_addrs(
392390
Ok(p) => {
393391
debug!("Sending peer request to {}", addr);
394392
if p.send_peer_request(capab).is_ok() {
395-
#[cfg(feature = "marketplace")]
396393
match addr {
397394
PeerAddr::Onion(_) => {
398395
if let Err(_) = libp2p_connection::add_new_peer(&addr) {

servers/src/grin/server.rs

-8
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,12 @@ use grin_util::secp::SecretKey;
7070
use std::collections::HashSet;
7171
use std::sync::atomic::Ordering;
7272

73-
#[cfg(feature = "marketplace")]
7473
use crate::p2p::libp2p_connection;
75-
#[cfg(feature = "marketplace")]
7674
use chrono::Utc;
77-
#[cfg(feature = "marketplace")]
7875
use grin_core::core::TxKernel;
79-
#[cfg(feature = "marketplace")]
8076
use grin_util::from_hex;
81-
#[cfg(feature = "marketplace")]
8277
use grin_util::secp::constants::SECRET_KEY_SIZE;
83-
#[cfg(feature = "marketplace")]
8478
use grin_util::secp::pedersen::Commitment;
85-
#[cfg(feature = "marketplace")]
8679
use std::collections::HashMap;
8780

8881
/// Arcified thread-safe TransactionPool with type parameters used by server components
@@ -410,7 +403,6 @@ impl Server {
410403
socks_port, config.tor_config.tor_enabled
411404
);
412405

413-
#[cfg(feature = "marketplace")]
414406
// Initialize libp2p server
415407
if config.libp2p_enabled.unwrap_or(true) && onion_address.is_some() && tor_secret.is_some()
416408
{

0 commit comments

Comments
 (0)