cuprate_blockchain::ops::alt_block

Function add_alt_transaction_blob

Source
pub fn add_alt_transaction_blob(
    tx: &VerifiedTransactionInformation,
    tables: &mut impl TablesMut,
) -> Result<(), RuntimeError>
Expand description

Adds a VerifiedTransactionInformation from an alt-block if it is not already in the DB.

If the transaction is in the main-chain this function will still fill in the AltTransactionInfos table, as that table holds data which we don’t keep around for main-chain txs.

§⚠️ Invariant ⚠️

This function mainly exists to be used internally by the parent function crate::ops::alt_block::add_alt_block.

add_alt_block() makes sure all data related to the input is mutated, while this function does not, it specifically mutates particular tables.

This is usually undesired - although this function is still available to call directly.

When calling this function, ensure that either:

  1. This effect (incomplete database mutation) is what is desired, or that…
  2. …the other tables will also be mutated to a correct state

§Errors

This function returns RuntimeError::KeyNotFound if the input (if applicable) doesn’t exist or other RuntimeError’s on database errors.