void *tx_load(int tx_op, shkey_t *tx_key) { if (!is_tx_stored(tx_op)) return (NULL); return (pstore_load(tx_op, shkey_hex(tx_key))); }
/** * @returns An allocated parent transaction or NULL. */ tx_t *get_tx_parent(tx_t *tx) { tx_t *p_tx; if (0 == shkey_cmp(&tx->tx_pkey, ashkey_blank())) return (NULL); return ((tx_t *)pstore_load(tx->tx_ptype, shkey_hex(&tx->tx_pkey))); }
/** * @note does not return allocated memory */ shpeer_t *load_asset_peer(shkey_t *id_key) { static shpeer_t ret_peer; tx_id_t *id; id = (tx_id_t *)pstore_load(TX_IDENT, (char *)shkey_hex(id_key)); if (!id) return (NULL); memcpy(&ret_peer, &id->id_peer, sizeof(shpeer_t)); return (&ret_peer); }
int process_asset_tx(tx_app_t *cli, tx_asset_t *asset) { tx_asset_t *ent; int err; err = remote_validate_asset(cli, asset); if (err) return (err); ent = (tx_asset_t *)pstore_load(TX_ASSET, asset->ass_tx.hash); if (!ent) return (0); /* no state info */ /* .. */ return (0); }
int process_bond_tx(tx_app_t *cli, tx_bond_t *bond) { tx_bond_t *ent; int err; err = remote_validate_bond(cli, bond); if (err) return (err); ent = (tx_bond_t *)pstore_load(TX_BOND, bond->bond_tx.hash); if (!ent) return (0); /* no state info */ switch (bond->bond_state) { /* .. */ } return (0); }
tx_bond_t *load_bond(shkey_t *bond_key) { return ((tx_bond_t *)pstore_load(TX_FILE, shkey_hex(bond_key))); }
tx_asset_t *load_asset(shkey_t *asset_key) { return ((tx_asset_t *)pstore_load(TX_ASSET, (char *)shkey_hex(asset_key))); }