Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/blocks/tipset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,8 @@ mod lotus_json {
#[schemars(rename = "TipsetInner")]
#[serde(rename_all = "PascalCase")]
struct TipsetLotusJsonInner {
#[serde(with = "crate::lotus_json")]
#[schemars(with = "LotusJson<TipsetKey>")]
cids: TipsetKey,
#[serde(with = "crate::lotus_json")]
#[schemars(with = "LotusJson<NonEmpty<CachingBlockHeader>>")]
blocks: NonEmpty<CachingBlockHeader>,
cids: <TipsetKey as HasLotusJson>::LotusJson,
blocks: <NonEmpty<CachingBlockHeader> as HasLotusJson>::LotusJson,
height: i64,
}

Expand All @@ -669,7 +665,10 @@ mod lotus_json {
height: _ignored1,
} = Deserialize::deserialize(deserializer)?;

Ok(Self(Tipset::new(blocks).map_err(D::Error::custom)?))
Ok(Self(
Tipset::new(NonEmpty::<CachingBlockHeader>::from_lotus_json(blocks))
.map_err(D::Error::custom)?,
))
}
}

Expand All @@ -680,9 +679,9 @@ mod lotus_json {
{
let Self(tipset) = self;
TipsetLotusJsonInner {
cids: tipset.key().clone(),
cids: tipset.key().clone().into_lotus_json(),
blocks: tipset.block_headers().clone().into_lotus_json(),
height: tipset.epoch(),
blocks: tipset.block_headers().clone(),
}
.serialize(serializer)
}
Expand Down
Loading