Skip to content

Commit 086c7bc

Browse files
authored
Merge branch 'master' into add-more-tests
2 parents c5cd413 + 2017d6d commit 086c7bc

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

integration_test/src/main.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ fn main() {
214214
test_get_descriptor_info(&cl);
215215
test_derive_addresses(&cl);
216216
test_add_multisig_address(&cl);
217+
test_get_mempool_info(&cl);
217218
//TODO import_multi(
218219
//TODO verify_message(
219220
//TODO encrypt_wallet(&self, passphrase: &str) -> Result<()> {
@@ -1382,6 +1383,36 @@ fn test_derive_addresses(cl: &Client) {
13821383
assert!(cl.derive_addresses(descriptor, None).is_err()); // Range must be specified for a ranged descriptor
13831384
}
13841385

1386+
fn test_get_mempool_info(cl: &Client) {
1387+
let res = cl.get_mempool_info().unwrap();
1388+
1389+
if version() >= 190000 {
1390+
assert!(res.loaded.is_some());
1391+
} else {
1392+
assert!(res.loaded.is_none());
1393+
}
1394+
1395+
if version() >= 210000 {
1396+
assert!(res.unbroadcast_count.is_some());
1397+
} else {
1398+
assert!(res.unbroadcast_count.is_none());
1399+
}
1400+
1401+
if version() >= 220000 {
1402+
assert!(res.total_fee.is_some());
1403+
} else {
1404+
assert!(res.total_fee.is_none());
1405+
}
1406+
1407+
if version() >= 240000 {
1408+
assert!(res.incremental_relay_fee.is_some());
1409+
assert!(res.full_rbf.is_some());
1410+
} else {
1411+
assert!(res.incremental_relay_fee.is_none());
1412+
assert!(res.full_rbf.is_none());
1413+
}
1414+
}
1415+
13851416
fn test_get_index_info(cl: &Client) {
13861417
if version() >= 210000 {
13871418
let gii = cl.get_index_info().unwrap();

json/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,16 +1059,16 @@ pub enum ImportMultiRequestScriptPubkey<'a> {
10591059
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
10601060
pub struct GetMempoolInfoResult {
10611061
/// True if the mempool is fully loaded
1062-
pub loaded: bool,
1062+
pub loaded: Option<bool>,
10631063
/// Current tx count
10641064
pub size: usize,
10651065
/// Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
10661066
pub bytes: usize,
10671067
/// Total memory usage for the mempool
10681068
pub usage: usize,
10691069
/// Total fees for the mempool in BTC, ignoring modified fees through prioritisetransaction
1070-
#[serde(with = "bitcoin::amount::serde::as_btc")]
1071-
pub total_fee: Amount,
1070+
#[serde(default, with = "bitcoin::amount::serde::as_btc::opt")]
1071+
pub total_fee: Option<Amount>,
10721072
/// Maximum memory usage for the mempool
10731073
#[serde(rename = "maxmempool")]
10741074
pub max_mempool: usize,
@@ -1079,14 +1079,14 @@ pub struct GetMempoolInfoResult {
10791079
#[serde(rename = "minrelaytxfee", with = "bitcoin::amount::serde::as_btc")]
10801080
pub min_relay_tx_fee: Amount,
10811081
/// Minimum fee rate increment for mempool limiting or replacement in BTC/kvB
1082-
#[serde(rename = "incrementalrelayfee", with = "bitcoin::amount::serde::as_btc")]
1083-
pub incremental_relay_fee: Amount,
1082+
#[serde(rename = "incrementalrelayfee", default, with = "bitcoin::amount::serde::as_btc::opt")]
1083+
pub incremental_relay_fee: Option<Amount>,
10841084
/// Current number of transactions that haven't passed initial broadcast yet
10851085
#[serde(rename = "unbroadcastcount")]
1086-
pub unbroadcast_count: usize,
1086+
pub unbroadcast_count: Option<usize>,
10871087
/// True if the mempool accepts RBF without replaceability signaling inspection
10881088
#[serde(rename = "fullrbf")]
1089-
pub full_rbf: bool,
1089+
pub full_rbf: Option<bool>,
10901090
}
10911091

10921092
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]

0 commit comments

Comments
 (0)