@@ -18,14 +18,17 @@ use crate::ScriptPubkey;
1818
1919/// Models the result of JSON-RPC method `getbestblockhash`.
2020#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
21+ #[ serde( deny_unknown_fields) ]
2122pub struct GetBestBlockHash ( pub BlockHash ) ;
2223
2324/// Models the result of JSON-RPC method `getblock` with verbosity set to 0.
2425#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
26+ #[ serde( deny_unknown_fields) ]
2527pub struct GetBlockVerboseZero ( pub Block ) ;
2628
2729/// Models the result of JSON-RPC method `getblock` with verbosity set to 1.
2830#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
31+ #[ serde( deny_unknown_fields) ]
2932pub struct GetBlockVerboseOne {
3033 /// The block hash (same as provided) in RPC call.
3134 pub hash : BlockHash ,
@@ -69,6 +72,7 @@ pub struct GetBlockVerboseOne {
6972
7073/// Models the result of JSON-RPC method `getblockchaininfo`.
7174#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
75+ #[ serde( deny_unknown_fields) ]
7276pub struct GetBlockchainInfo {
7377 /// Current network name as defined in BIP70 (main, test, signet, regtest).
7478 pub chain : Network ,
@@ -114,6 +118,7 @@ pub struct GetBlockchainInfo {
114118
115119/// Status of softfork.
116120#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
121+ #[ serde( deny_unknown_fields) ]
117122pub struct Softfork {
118123 /// The [`SoftforkType`]: one of "buried", "bip9".
119124 #[ serde( rename = "type" ) ]
@@ -142,6 +147,7 @@ pub enum SoftforkType {
142147
143148/// Status of BIP-9 softforks.
144149#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
150+ #[ serde( deny_unknown_fields) ]
145151pub struct Bip9SoftforkInfo {
146152 /// One of "defined", "started", "locked_in", "active", "failed".
147153 pub status : Bip9SoftforkStatus ,
@@ -176,6 +182,7 @@ pub enum Bip9SoftforkStatus {
176182
177183/// Statistics for a BIP-9 softfork.
178184#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
185+ #[ serde( deny_unknown_fields) ]
179186pub struct Bip9SoftforkStatistics {
180187 /// The length in blocks of the BIP9 signalling period.
181188 pub period : u32 ,
@@ -191,10 +198,12 @@ pub struct Bip9SoftforkStatistics {
191198
192199/// Models the result of JSON-RPC method `getblockcount`.
193200#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
201+ #[ serde( deny_unknown_fields) ]
194202pub struct GetBlockCount ( pub u64 ) ;
195203
196204/// Models the result of JSON-RPC method `getblockfilter`.
197205#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
206+ #[ serde( deny_unknown_fields) ]
198207pub struct GetBlockFilter {
199208 /// The filter data.
200209 pub filter : Vec < u8 > ,
@@ -204,14 +213,17 @@ pub struct GetBlockFilter {
204213
205214/// Models the result of JSON-RPC method `getblockhash`.
206215#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
216+ #[ serde( deny_unknown_fields) ]
207217pub struct GetBlockHash ( pub BlockHash ) ;
208218
209219/// Models the result of JSON-RPC method `getblockheader`.
210220#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
221+ #[ serde( deny_unknown_fields) ]
211222pub struct GetBlockHeader ( pub block:: Header ) ;
212223
213224/// Models the result of JSON-RPC method `getblockheader`.
214225#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
226+ #[ serde( deny_unknown_fields) ]
215227pub struct GetBlockHeaderVerbose {
216228 /// the block hash (same as provided).
217229 pub hash : BlockHash ,
@@ -247,6 +259,7 @@ pub struct GetBlockHeaderVerbose {
247259
248260/// Models the result of JSON-RPC method `getblockstats`.
249261#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
262+ #[ serde( deny_unknown_fields) ]
250263pub struct GetBlockStats {
251264 /// Average fee in the block.
252265 pub average_fee : Amount ,
@@ -316,10 +329,12 @@ pub struct GetBlockStats {
316329
317330/// Models the result of JSON-RPC method `getchaintips`.
318331#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
332+ #[ serde( deny_unknown_fields) ]
319333pub struct GetChainTips ( pub Vec < ChainTips > ) ;
320334
321335/// An individual list item from the result of JSON-RPC method `getchaintips`.
322336#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
337+ #[ serde( deny_unknown_fields) ]
323338pub struct ChainTips {
324339 /// Height of the chain tip.
325340 pub height : u32 ,
@@ -349,6 +364,7 @@ pub enum ChainTipsStatus {
349364
350365/// Models the result of JSON-RPC method `getchaintxstats`.
351366#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
367+ #[ serde( deny_unknown_fields) ]
352368pub struct GetChainTxStats {
353369 /// The timestamp for the final block in the window in UNIX format.
354370 pub time : u32 ,
@@ -370,30 +386,37 @@ pub struct GetChainTxStats {
370386
371387/// Models the result of JSON-RPC method `getdifficulty`.
372388#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
389+ #[ serde( deny_unknown_fields) ]
373390pub struct GetDifficulty ( pub f64 ) ;
374391
375392/// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to false.
376393#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
394+ #[ serde( deny_unknown_fields) ]
377395pub struct GetMempoolAncestors ( pub Vec < Txid > ) ;
378396
379397/// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to true.
380398#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
399+ #[ serde( deny_unknown_fields) ]
381400pub struct GetMempoolAncestorsVerbose ( pub BTreeMap < Txid , MempoolEntry > ) ;
382401
383402/// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to false.
384403#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
404+ #[ serde( deny_unknown_fields) ]
385405pub struct GetMempoolDescendants ( pub Vec < Txid > ) ;
386406
387407/// Models the result of JSON-RPC method `getmempooldescendants` with verbose set to true.
388408#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
409+ #[ serde( deny_unknown_fields) ]
389410pub struct GetMempoolDescendantsVerbose ( pub BTreeMap < Txid , MempoolEntry > ) ;
390411
391412/// Models the result of JSON-RPC method `getmempoolentry`.
392413#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
414+ #[ serde( deny_unknown_fields) ]
393415pub struct GetMempoolEntry ( pub MempoolEntry ) ;
394416
395417/// A relative (ancestor or descendant) transaction of a transaction in the mempool.
396418#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
419+ #[ serde( deny_unknown_fields) ]
397420pub struct MempoolEntry {
398421 /// Virtual transaction size as defined in BIP 141. v0.19 and later only.
399422 ///
@@ -436,6 +459,7 @@ pub struct MempoolEntry {
436459
437460/// (No docs in Core v0.17.)
438461#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
462+ #[ serde( deny_unknown_fields) ]
439463pub struct MempoolEntryFees {
440464 /// Transaction fee in BTC.
441465 pub base : Amount ,
@@ -449,6 +473,7 @@ pub struct MempoolEntryFees {
449473
450474/// Models the result of JSON-RPC method `getmempoolinfo` with verbose set to true.
451475#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
476+ #[ serde( deny_unknown_fields) ]
452477pub struct GetMempoolInfo {
453478 /// True if the mempool is fully loaded. v0.19 and later only.
454479 pub loaded : Option < bool > ,
@@ -482,14 +507,17 @@ pub struct GetMempoolInfo {
482507
483508/// Models the result of JSON-RPC method `getrawmempool` with verbose set to false.
484509#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
510+ #[ serde( deny_unknown_fields) ]
485511pub struct GetRawMempool ( pub Vec < Txid > ) ;
486512
487513/// Models the result of JSON-RPC method `getrawmempool` with verbose set to true.
488514#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
515+ #[ serde( deny_unknown_fields) ]
489516pub struct GetRawMempoolVerbose ( pub BTreeMap < Txid , MempoolEntry > ) ;
490517
491518/// Models the result of JSON-RPC method `gettxout`.
492519#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
520+ #[ serde( deny_unknown_fields) ]
493521pub struct GetTxOut {
494522 /// The hash of the block at the tip of the chain.
495523 pub best_block : BlockHash ,
@@ -507,6 +535,7 @@ pub struct GetTxOut {
507535
508536/// Models the result of JSON-RPC method `gettxoutsetinfo`.
509537#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
538+ #[ serde( deny_unknown_fields) ]
510539pub struct GetTxOutSetInfo {
511540 /// The current block height (index).
512541 pub height : u32 ,
@@ -533,10 +562,12 @@ pub struct GetTxOutSetInfo {
533562
534563/// Models the result of JSON-RPC method `verifytxoutproof`.
535564#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
565+ #[ serde( deny_unknown_fields) ]
536566pub struct VerifyTxOutProof ( pub Vec < Txid > ) ;
537567
538568/// Models the result of the JSON-RPC method `getdescriptoractivity`.
539569#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
570+ #[ serde( deny_unknown_fields) ]
540571pub struct GetDescriptorActivity {
541572 /// A list of activity events related to the descriptors.
542573 pub activity : Vec < ActivityEntry > ,
@@ -553,6 +584,7 @@ pub enum ActivityEntry {
553584
554585/// Models a 'spend' activity event with strongly typed fields.
555586#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
587+ #[ serde( deny_unknown_fields) ]
556588pub struct SpendActivity {
557589 /// The total amount of the spent output.
558590 pub amount : Amount ,
@@ -574,6 +606,7 @@ pub struct SpendActivity {
574606
575607/// Models a 'receive' activity event with strongly typed fields.
576608#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
609+ #[ serde( deny_unknown_fields) ]
577610pub struct ReceiveActivity {
578611 /// The total amount in BTC of the new output, converted to `bitcoin::Amount`.
579612 pub amount : Amount ,
0 commit comments