Skip to content

Commit

Permalink
Merge branch '2.0' into chain_switching_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Dec 6, 2023
2 parents a5c2d11 + 0738cfc commit 4c59eea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions sdk/src/client/api/block_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl ClientInner {
pub async fn build_basic_block(&self, issuer_id: AccountId, payload: Option<Payload>) -> Result<UnsignedBlock> {
let issuance = self.get_issuance().await?;

// TODO https://github.com/iotaledger/iota-sdk/issues/1753
let issuing_time = {
#[cfg(feature = "std")]
let issuing_time = std::time::SystemTime::now()
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/types/api/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ pub struct IssuanceBlockHeaderResponse {
/// Blocks that are directly referenced to adjust opinion.
#[serde(default, skip_serializing_if = "BTreeSet::is_empty")]
pub shallow_like_parents: BTreeSet<BlockId>,
// Latest issuing time of the returned parents.
#[serde(with = "string")]
pub latest_parent_block_issuing_time: u64,
/// The slot index of the latest finalized slot.
pub latest_finalized_slot: SlotIndex,
/// The latest slot commitment.
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/wallet/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ pub enum Error {
/// Implicit account not found.
#[error("implicit account not found")]
ImplicitAccountNotFound,
/// No account was provided or found to issue the block.
#[error("no account was provided or found to issue the block")]
NoAccountToIssueBlock,
}

impl Error {
Expand Down
12 changes: 10 additions & 2 deletions sdk/src/wallet/operations/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ where
) -> Result<BlockId> {
log::debug!("submit_basic_block");

// TODO https://github.com/iotaledger/iota-sdk/issues/1741
let issuer_id = issuer_id.into().unwrap_or(AccountId::null());
let issuer_id = match issuer_id.into() {
Some(issuer_id) => Some(issuer_id),
None => self
.data()
.await
.accounts()
.next()
.map(|o| o.output.as_account().account_id_non_null(&o.output_id)),
}
.ok_or(Error::NoAccountToIssueBlock)?;

let block = self
.client()
Expand Down

0 comments on commit 4c59eea

Please sign in to comment.