remove OutboundLaneApi::latest_received_nonce (#1262)

This commit is contained in:
Svyatoslav Nikolsky
2021-12-23 12:50:39 +03:00
committed by Bastian Köcher
parent 13a3974f27
commit 988f6b1664
17 changed files with 9 additions and 64 deletions
@@ -149,16 +149,19 @@ where
&self,
id: SourceHeaderIdOf<MessageLaneAdapter<P>>,
) -> Result<(SourceHeaderIdOf<MessageLaneAdapter<P>>, MessageNonce), SubstrateError> {
let encoded_response = self
let outbound_lane_data: Option<OutboundLaneData> = self
.client
.state_call(
P::TargetChain::TO_CHAIN_LATEST_RECEIVED_NONCE_METHOD.into(),
Bytes(self.lane_id.encode()),
.storage_value(
outbound_lane_data_key(
P::TargetChain::WITH_CHAIN_MESSAGES_PALLET_NAME,
&self.lane_id,
),
Some(id.1),
)
.await?;
let latest_received_nonce: MessageNonce = Decode::decode(&mut &encoded_response.0[..])
.map_err(SubstrateError::ResponseParseFailed)?;
// lane data missing from the storage is fine until first message is sent
let latest_received_nonce =
outbound_lane_data.map(|data| data.latest_received_nonce).unwrap_or(0);
Ok((id, latest_received_nonce))
}