Skip to content

Commit dca3d5a

Browse files
committed
chore: address PR feedback
1 parent 6e2baf7 commit dca3d5a

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

stackslib/src/main.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
3636
use std::fs::File;
3737
use std::io::prelude::*;
3838
use std::io::BufReader;
39-
use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6, TcpStream, ToSocketAddrs};
39+
use std::net::{SocketAddr, TcpStream, ToSocketAddrs};
4040
use std::time::Duration;
4141
use std::{env, fs, io, process, thread};
4242

@@ -140,14 +140,8 @@ impl P2PSession {
140140
/// Returns the session handle on success.
141141
/// Returns error text on failure.
142142
pub fn begin(peer_addr: SocketAddr, data_port: u16) -> Result<Self, String> {
143-
let data_addr = match peer_addr {
144-
SocketAddr::V4(v4addr) => {
145-
SocketAddr::V4(SocketAddrV4::new(v4addr.ip().clone(), data_port))
146-
}
147-
SocketAddr::V6(v6addr) => {
148-
SocketAddr::V6(SocketAddrV6::new(v6addr.ip().clone(), data_port, 0, 0))
149-
}
150-
};
143+
let mut data_addr = peer_addr.clone();
144+
data_addr.set_port(data_port);
151145

152146
// get /v2/info
153147
let peer_info = send_http_request(
@@ -1143,6 +1137,14 @@ simulating a miner.
11431137
}
11441138

11451139
if argv[1] == "getnakamotoinv" {
1140+
if argv.len() < 5 {
1141+
eprintln!(
1142+
"Usage: {} getnakamotoinv HOST:PORT DATA_PORT CONSENSUS_HASH",
1143+
&argv[0]
1144+
);
1145+
process::exit(1);
1146+
}
1147+
11461148
let peer_addr: SocketAddr = argv[2].to_socket_addrs().unwrap().next().unwrap();
11471149
let data_port: u16 = argv[3].parse().unwrap();
11481150
let ch = ConsensusHash::from_hex(&argv[4]).unwrap();

stackslib/src/net/api/getsortition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,14 @@ impl StacksHttpRequest {
392392
StacksHttpRequest::new_for_peer(
393393
host,
394394
"GET".into(),
395-
format!("/v3/sortitions/{}/{}", sort_key, sort_value),
395+
format!("{}/{}/{}", RPC_SORTITION_INFO_PATH, sort_key, sort_value),
396396
HttpRequestContents::new(),
397397
)
398398
.expect("FATAL: failed to construct request from infallible data")
399399
}
400400

401401
pub fn new_get_sortition_consensus(host: PeerHost, ch: &ConsensusHash) -> StacksHttpRequest {
402-
Self::new_get_sortition(host, "consensus", &format!("{}", ch))
402+
Self::new_get_sortition(host, "consensus", &ch.to_string())
403403
}
404404
}
405405

stackslib/src/net/inv/nakamoto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl InvGenerator {
251251
// The table removals here are for cache maintenance.
252252
//
253253
// Between successive calls to this function, the Stacks tip (identified by
254-
// `tip_block_ch` and `tip_block_bh) can advance as more blocks are discovered.
254+
// `tip_block_ch` and `tip_block_bh`) can advance as more blocks are discovered.
255255
// This means that tenures that had previously been treated as absent could now be
256256
// present. By evicting cached data for all tenures between (and including) the
257257
// highest ancestor of the current Stacks tip, and the current Stacks tip, we force

0 commit comments

Comments
 (0)