let expected_blocks = height.checked_sub(current).with_context(|| {
format!("current {current} height is greater than sat height {height}")
})?;
Ok(Blocktime::Expected(
Utc::now()
.round_subsecs(0)
.checked_add_signed(chrono::Duration::seconds(
10 * 60 * i64::try_from(expected_blocks)?,
))
.ok_or_else(|| anyhow!("block timestamp out of range"))?,
))
}
}
}
pub(crate) fn get_inscriptions(
&self,
utxos: &BTreeMap<OutPoint, Amount>,
) -> Result<BTreeMap<SatPoint, InscriptionId>> {
let rtx = self.database.begin_read()?;
let mut result = BTreeMap::new();
let satpoint_to_sequence_number = rtx.open_multimap_table(SATPOINT_TO_SEQUENCE_NUMBER)?;
let sequence_number_to_inscription_entry =
rtx.open_table(SEQUENCE_NUMBER_TO_INSCRIPTION_ENTRY)?;
for utxo in utxos.keys() {
result.extend(Self::inscriptions_on_output(
&satpoint_to_sequence_number,