Check TX ID when saving token ID to database

This commit is contained in:
silverpill 2022-05-10 20:54:01 +00:00
parent 0268f6edc8
commit b7849c8264
2 changed files with 5 additions and 1 deletions

View file

@ -542,6 +542,7 @@ paths:
transaction_id:
type: string
description: Transaction ID
example: '581186ab56765aed64a3e73172872a6454c604c6b4e08a8ed03eabad94e74d64'
responses:
200:
description: Successful operation

View file

@ -127,7 +127,10 @@ pub async fn process_nft_events(
let token_id: i32 = token_id_u256.try_into()
.map_err(|_| EthereumError::ConversionError)?;
post.token_id = Some(token_id);
post.token_tx_id = Some(tx_id);
if post.token_tx_id.as_ref() != Some(&tx_id) {
log::warn!("overwriting incorrect tx id {:?}", post.token_tx_id);
post.token_tx_id = Some(tx_id);
};
update_post(db_client, &post).await?;
token_waitlist_map.remove(&post.id);
};