Skip to content

Commit f515d26

Browse files
authored
Merge pull request #139 from tcharding/04-30-check-no-model
verify: Check that no model type exists
2 parents 2d46c02 + 3816328 commit f515d26

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

types/src/model/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ pub use self::{
5151
GetTransactionDetail, GetUnconfirmedBalance, GetWalletInfo, ListAddressGroupings,
5252
ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem,
5353
ListReceivedByAddress, ListReceivedByAddressItem, ListSinceBlock,
54-
ListSinceBlockTransaction, ListTransactions, ListTransactionsItem, ListUnspentItem,
55-
ListWallets, LoadWallet, RescanBlockchain, ScriptType, SendMany, SendToAddress,
56-
SignMessage, TransactionCategory, UnloadWallet, WalletCreateFundedPsbt, WalletProcessPsbt,
54+
ListSinceBlockTransaction, ListTransactions, ListTransactionsItem, ListUnspent,
55+
ListUnspentItem, ListWallets, LoadWallet, RescanBlockchain, ScriptType, SendMany,
56+
SendToAddress, SignMessage, TransactionCategory, UnloadWallet, WalletCreateFundedPsbt,
57+
WalletProcessPsbt,
5758
},
5859
};

verify/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ fn check_types_exist_if_required(version: Version, method_name: &str) -> Result<
164164
if !model::type_exists(version, method_name)? {
165165
eprintln!("missing model type: {}", output_method(out));
166166
}
167+
} else {
168+
if model::type_exists(version, method_name)? {
169+
eprintln!("found model type when none expected: {}", output_method(out));
170+
}
167171
}
168172
Ok(())
169173
}

verify/src/method/v19.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub const METHODS: &[Method] = &[
1010
Method::new_modelled("getblock", "GetBlockVerboseZero", "get_block"), // We only check one of the types.
1111
Method::new_modelled("getblockchaininfo", "GetBlockchainInfo", "get_blockchain_info"),
1212
Method::new_modelled("getblockcount", "GetBlockCount", "get_block_count"),
13-
Method::new_no_model("getblockfilter", "GetBlockFilter", "get_block_filter"), // TODO: Use modelled.
13+
Method::new_modelled("getblockfilter", "GetBlockFilter", "get_block_filter"),
1414
Method::new_modelled("getblockhash", "GetBlockHash", "get_block_hash"),
1515
Method::new_modelled("getblockheader", "GetBlockHeader", "get_block_header"),
1616
Method::new_modelled("getblockstats", "GetBlockStats", "get_block_stats"),

verify/src/model.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ pub fn type_exists(version: Version, method_name: &str) -> Result<bool> {
4040
};
4141

4242
if let Some(Return::Type(s)) = method.ret {
43-
if method.requires_model {
44-
return crate::grep_for_string(&path(), s);
45-
}
43+
return crate::grep_for_re_export(&path(), s);
4644
}
4745
Ok(false)
4846
}

0 commit comments

Comments
 (0)