Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions integration_test/tests/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,15 @@ fn network__get_network_info__modelled() {
}

#[test]
// Core version 18 onwards.
#[cfg(not(feature = "v17"))]
fn network__get_node_addresses() {
let node = Node::with_wallet(Wallet::None, &[]);
let json: GetNodeAddresses = node.client.get_node_addresses().expect("getnodeaddresses");
let res: Result<mtype::GetNodeAddresses, _> = json.into_model();
let model = res.expect("GetNodeAddresses into model");
assert!(model.0.len() <= 2500);
if let Some(addr) = model.0.first() {
assert!(addr.port > 0);
assert!(addr.time > 1231006505);
}
let (node1, node2, node3) = integration_test::three_node_network();

node1.mine_a_block();
node2.mine_a_block();
node3.mine_a_block();

let _: GetNodeAddresses = node1.client.get_node_addresses().expect("getnodeaddresses");
}

#[test]
Expand Down
4 changes: 1 addition & 3 deletions types/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ pub use self::{
BlockTemplateTransaction, GetBlockTemplate, GetMiningInfo, GetPrioritisedTransactions,
NextBlockInfo, PrioritisedTransaction,
},
network::{
GetNetworkInfo, GetNetworkInfoAddress, GetNetworkInfoNetwork, GetNodeAddresses, NodeAddress,
},
network::{GetNetworkInfo, GetNetworkInfoAddress, GetNetworkInfoNetwork},
raw_transactions::{
AnalyzePsbt, AnalyzePsbtInput, AnalyzePsbtInputMissing, CombinePsbt, CombineRawTransaction,
ConvertToPsbt, CreatePsbt, CreateRawTransaction, DecodePsbt, DecodeRawTransaction,
Expand Down
26 changes: 1 addition & 25 deletions types/src/model/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
//! These structs model the types returned by the JSON-RPC API but have concrete types
//! and are not specific to a specific version of Bitcoin Core.

use bitcoin::address::NetworkUnchecked;
use bitcoin::{Address, FeeRate};
use bitcoin::FeeRate;
use serde::{Deserialize, Serialize};

/// Models the result of JSON-RPC method `getnetworkinfo`.
Expand Down Expand Up @@ -74,26 +73,3 @@ pub struct GetNetworkInfoAddress {
/// Relative score.
pub score: u32,
}

/// Result of JSON-RPC method `getnodeaddresses`.
///
/// > getnodeaddresses ( count )
/// >
/// > Return known addresses which can potentially be used to find new nodes in the network.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct GetNodeAddresses(pub Vec<NodeAddress>);

/// An item from the list returned by the JSON-RPC method `getnodeaddresses`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct NodeAddress {
/// Timestamp in seconds since epoch (Jan 1 1970 GMT) when the node was last seen.
pub time: u64,
/// The services offered.
pub services: u64,
/// The address of the node.
pub address: Address<NetworkUnchecked>,
/// The port of the node.
pub port: u16,
}
2 changes: 1 addition & 1 deletion types/src/v18/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
28 changes: 0 additions & 28 deletions types/src/v18/network/into.rs

This file was deleted.

2 changes: 0 additions & 2 deletions types/src/v18/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
//!
//! Types for methods found under the `== Network ==` section of the API docs.

mod into;

use alloc::collections::BTreeMap;

use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion types/src/v19/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v20/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v21/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v22/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v23/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v24/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v25/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v26/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v27/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | TODO |
//! | getnodeaddresses | version | TODO |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v28/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion types/src/v29/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
//! | getconnectioncount | version | |
//! | getnettotals | version | |
//! | getnetworkinfo | version + model | |
//! | getnodeaddresses | version + model | |
//! | getnodeaddresses | version | |
//! | getpeerinfo | version | |
//! | listbanned | version | |
//! | ping | returns nothing | |
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v18.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v19.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v23.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v24.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v25.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
2 changes: 1 addition & 1 deletion verify/src/method/v26.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub const METHODS: &[Method] = &[
Method::new_no_model("getconnectioncount", "GetConnectionCount", "get_connection_count"),
Method::new_no_model("getnettotals", "GetNetTotals", "get_net_totals"),
Method::new_modelled("getnetworkinfo", "GetNetworkInfo", "get_network_info"),
Method::new_modelled("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getnodeaddresses", "GetNodeAddresses", "get_node_addresses"),
Method::new_no_model("getpeerinfo", "GetPeerInfo", "get_peer_info"),
Method::new_no_model("listbanned", "ListBanned", "list_banned"),
Method::new_nothing("ping", "ping"),
Expand Down
Loading