Skip to content

Commit 4e70a4b

Browse files
committed
Add missing fields to getbalances
There is a missing return field in v26 `getbalances`. Redefine the type for v26 with the missing fields. Update the model, error, into functions and reexports.
1 parent 99f6871 commit 4e70a4b

File tree

16 files changed

+102
-18
lines changed

16 files changed

+102
-18
lines changed

types/src/model/wallet.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ pub struct GetBalance(pub Amount);
232232
pub struct GetBalances {
233233
/// Balances from outputs that the wallet can sign.
234234
pub mine: GetBalancesMine,
235+
/// Watchonly balances (not present if wallet does not watch anything).
235236
pub watch_only: Option<GetBalancesWatchOnly>,
237+
/// Hash and height of the block this information was generated on. v26 and later only.
238+
#[serde(rename = "lastprocessedblock")]
239+
pub last_processed_block: Option<LastProcessedBlock>,
236240
}
237241

238242
/// Balances from outputs that the wallet can sign.

types/src/v19/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub use self::{
244244
control::GetRpcInfo,
245245
network::{GetNetworkInfo, GetPeerInfo, PeerInfo},
246246
util::GetDescriptorInfo,
247-
wallet::{GetBalances, GetBalancesMine, GetBalancesWatchOnly, GetTransaction},
247+
wallet::{GetBalances, GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetTransaction},
248248
};
249249
#[doc(inline)]
250250
pub use crate::v17::{

types/src/v19/wallet/into.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ impl GetBalances {
2121
.map(|watch_only| watch_only.into_model())
2222
.transpose()
2323
.map_err(E::WatchOnly)?;
24+
let last_processed_block = None; // v26 and later only.
2425

25-
Ok(model::GetBalances { mine, watch_only })
26+
Ok(model::GetBalances { mine, watch_only, last_processed_block })
2627
}
2728
}
2829

types/src/v20/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,6 @@ pub use crate::{
286286
GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose,
287287
GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, GetRpcInfo,
288288
MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees,
289-
MempoolEntryFeesError, PeerInfo, Softfork, SoftforkType,
289+
MempoolEntryFeesError, PeerInfo, Softfork, SoftforkType, GetBalancesError,
290290
},
291291
};

types/src/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ pub use crate::{
292292
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
293293
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
294294
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
295+
GetBalancesError,
295296
},
296297
v20::{Banned, CreateMultisig, ListBanned, Logging, GetTransaction, GetTransactionDetail},
297298
};

types/src/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ pub use crate::{
302302
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
303303
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
304304
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
305+
GetBalancesError,
305306
},
306307
v20::{CreateMultisig, GetTransaction, GetTransactionDetail},
307308
v21::{

types/src/v23/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub use crate::{
301301
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
302302
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
303303
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
304-
Softfork, SoftforkType,
304+
Softfork, SoftforkType, GetBalancesError,
305305
},
306306
v20::GetTransactionDetail,
307307
v21::{GetNetworkInfo, UnloadWallet},

types/src/v24/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub use crate::{
301301
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
302302
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
303303
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
304-
Softfork, SoftforkType,
304+
Softfork, SoftforkType, GetBalancesError,
305305
},
306306
v21::{GetNetworkInfo, UnloadWallet},
307307
v22::{Banned, ListBanned, ScriptPubkey},

types/src/v25/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub use crate::{
296296
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
297297
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,
298298
MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo,
299-
Softfork, SoftforkType,
299+
Softfork, SoftforkType, GetBalancesError,
300300
},
301301
v21::GetNetworkInfo,
302302
v22::{Banned, ListBanned, ScriptPubkey},

types/src/v26/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub use self::{
266266
SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees,
267267
SubmitPackageTxResultFeesError,
268268
},
269-
wallet::{CreateWallet, GetTransaction, GetTransactionError, LastProcessedBlock, LastProcessedBlockError, LoadWallet, UnloadWallet},
269+
wallet::{CreateWallet, GetTransaction, GetTransactionError, LastProcessedBlock, LastProcessedBlockError, LoadWallet, UnloadWallet, GetBalances, GetBalancesError},
270270
};
271271
#[doc(inline)]
272272
pub use crate::{
@@ -308,7 +308,7 @@ pub use crate::{
308308
ListWalletDir, ListWalletDirWallet, NodeAddress, UtxoUpdatePsbt,
309309
},
310310
v19::{
311-
Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesMine,
311+
Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine,
312312
GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError,
313313
GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose,
314314
GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError,

0 commit comments

Comments
 (0)