Skip to content

Commit e25af9a

Browse files
committed
fix: use v26 getpeerinfo for v26, v27, v28, v29
Previously, the v0.17 getpeerinfo types were used for v26, v27, v28, and v29. Also adds the `mapped_as` field to the response that was missing in the v26 type. I manually checked that the changes since v26 were only minor doc changes for getpeerinfo by diffing `bitcoin-cli help getpeerinfo` for the mentioned version.
1 parent 2d0c090 commit e25af9a

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

types/src/v26/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ pub use self::{
260260
blockchain::{GetTxOutSetInfo, GetTxOutSetInfoError},
261261
control::Logging,
262262
mining::{GetPrioritisedTransactions, PrioritisedTransaction},
263-
network::GetPeerInfo,
263+
network::{GetPeerInfo, PeerInfo},
264264
raw_transactions::{
265265
DescriptorProcessPsbt, DescriptorProcessPsbtError, SubmitPackage, SubmitPackageError,
266266
SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees,
@@ -315,8 +315,8 @@ pub use crate::{
315315
GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError,
316316
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
317317
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
318-
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
319-
SetWalletFlag, Softfork, SoftforkType,
318+
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag,
319+
Softfork, SoftforkType,
320320
},
321321
v20::GenerateToDescriptor,
322322
v21::{

types/src/v26/network.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: CC0-1.0
22

3-
//! The JSON-RPC API for Bitcoin Core `v23` - network.
3+
//! The JSON-RPC API for Bitcoin Core `v26` - network.
44
//!
55
//! Types for methods found under the `== Network ==` section of the API docs.
66
@@ -32,8 +32,10 @@ pub struct PeerInfo {
3232
/// Local address as reported by the peer.
3333
#[serde(rename = "addrlocal")]
3434
pub address_local: Option<String>,
35-
/// Network (ipv4, ipv6, or onion) the peer connected through.
36-
pub network: Option<String>,
35+
/// Network (ipv4, ipv6, onion, i2p, cjdns, not_publicly_routable) the peer connected through.
36+
pub network: String,
37+
/// Mapped AS (Autonomous System) number at the end of the BGP route to the peer, used for diversifying peer selection (only displayed if the -asmap config option is set).
38+
pub mapped_as: Option<u32>,
3739
/// The services offered.
3840
pub services: String,
3941
/// The services offered, in human-readable form. v0.19 and later only.

types/src/v27/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ pub use crate::{
292292
GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError,
293293
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
294294
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
295-
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
296-
SetWalletFlag, Softfork, SoftforkType,
295+
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag,
296+
Softfork, SoftforkType,
297297
},
298298
v20::GenerateToDescriptor,
299299
v21::{
@@ -317,8 +317,8 @@ pub use crate::{
317317
CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, GetBalances,
318318
GetBalancesError, GetPeerInfo, GetPrioritisedTransactions, GetTransaction,
319319
GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, LastProcessedBlock,
320-
LastProcessedBlockError, LoadWallet, Logging, PrioritisedTransaction, SubmitPackage,
321-
SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError,
320+
LastProcessedBlockError, LoadWallet, Logging, PeerInfo, PrioritisedTransaction,
321+
SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError,
322322
SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, UnloadWallet,
323323
},
324324
};

types/src/v28/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ pub use crate::{
313313
GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError,
314314
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
315315
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
316-
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
317-
SetWalletFlag, Softfork, SoftforkType,
316+
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag,
317+
Softfork, SoftforkType,
318318
},
319319
v20::GenerateToDescriptor,
320320
v21::{
@@ -338,6 +338,6 @@ pub use crate::{
338338
CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, GetBalances,
339339
GetBalancesError, GetPeerInfo, GetPrioritisedTransactions, GetTransactionError,
340340
GetTxOutSetInfo, GetTxOutSetInfoError, LastProcessedBlock, LastProcessedBlockError,
341-
LoadWallet, PrioritisedTransaction, UnloadWallet,
341+
LoadWallet, PeerInfo, PrioritisedTransaction, UnloadWallet,
342342
},
343343
};

types/src/v29/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ pub use crate::{
311311
GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetChainTxStats,
312312
GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants,
313313
GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry,
314-
MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, SetWalletFlag,
315-
Softfork, SoftforkType,
314+
MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag, Softfork,
315+
SoftforkType,
316316
},
317317
v20::GenerateToDescriptor,
318318
v21::{
@@ -334,12 +334,12 @@ pub use crate::{
334334
v25::{GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors},
335335
v26::{
336336
CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, GetBalances,
337-
GetBalancesError, GetPrioritisedTransactions, GetTransactionError, GetTxOutSetInfo,
338-
GetTxOutSetInfoError, LastProcessedBlock, LastProcessedBlockError, LoadWallet,
339-
PrioritisedTransaction, UnloadWallet,
337+
GetBalancesError, GetPeerInfo, GetPrioritisedTransactions, GetTransactionError,
338+
GetTxOutSetInfo, GetTxOutSetInfoError, LastProcessedBlock, LastProcessedBlockError,
339+
LoadWallet, PeerInfo, PrioritisedTransaction, UnloadWallet,
340340
},
341341
v28::{
342-
GetNetworkInfo, GetPeerInfo, GetTransaction, Logging, SubmitPackage, SubmitPackageError,
342+
GetNetworkInfo, GetTransaction, Logging, SubmitPackage, SubmitPackageError,
343343
SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees,
344344
SubmitPackageTxResultFeesError,
345345
},

0 commit comments

Comments
 (0)