Skip to content

Commit

Permalink
fix: BRC20 Transfer check failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyvic committed Mar 31, 2024
1 parent d6a9e24 commit 9af297c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/okx/protocol/brc20/msg_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ impl Message {
let Some(transfer_info) = transfer_assets_cache.get(&op.old_satpoint.store()) else {
return Ok(None);
};
// If the inscription_id of the transfer operation is different from the inscription_id of the transferable log, it is invalid.
if transfer_info.inscription_id != op.inscription_id {
return Ok(None);
}
Operation::Transfer(Transfer {
tick: transfer_info.tick.as_str().to_string(),
amount: transfer_info.amount.to_string(),
Expand Down
10 changes: 2 additions & 8 deletions src/subcommand/server/sat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ pub(crate) async fn sat_range_by_outpoint(
Ok(Json(ApiResponse::ok(ApiOutPointResult {
result: sat_ranges.map(|ranges| ApiSatRanges {
outpoint,
sat_ranges: ranges
.into_iter()
.map(ApiSatRange::Sketchy)
.collect(),
sat_ranges: ranges.into_iter().map(ApiSatRange::Sketchy).collect(),
}),
latest_height: latest_height.n(),
latest_blockhash: latest_blockhash.to_string(),
Expand Down Expand Up @@ -145,10 +142,7 @@ mod tests {
let sat_ranges = vec![(0, 100), (100, 200)];
let api_outpoint_sat_ranges = ApiSatRanges {
outpoint,
sat_ranges: sat_ranges
.into_iter()
.map(ApiSatRange::Sketchy)
.collect(),
sat_ranges: sat_ranges.into_iter().map(ApiSatRange::Sketchy).collect(),
};
let json = serde_json::to_string(&api_outpoint_sat_ranges).unwrap();
assert_eq!(
Expand Down

0 comments on commit 9af297c

Please sign in to comment.