Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit 06823c6

Browse files
committed
Add a len/is_empty functions to GenerateToAddress
Add a convenience functions to the `GenerateToAddress` model type to get the number of blocks generated.
1 parent bc2870f commit 06823c6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

json/src/model/generating.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ use serde::{Deserialize, Serialize};
1111
/// Models the result of JSON-RPC method `generatetoaddress`.
1212
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
1313
pub struct GenerateToAddress(pub Vec<BlockHash>);
14+
15+
impl GenerateToAddress {
16+
/// Returns the number of blocks generated.
17+
pub fn len(&self) -> usize { self.0.len() }
18+
19+
/// Returns true if 0 blocks were generated.
20+
pub fn is_empty(&self) -> bool { self.0.is_empty() }
21+
}

0 commit comments

Comments
 (0)