Skip to content

Commit

Permalink
Merge pull request #19 from enigmampc/fix-self-transfer-duplicate-his…
Browse files Browse the repository at this point in the history
…tory

Fix self transfer duplicate history
  • Loading branch information
reuvenpo authored Jun 14, 2021
2 parents 5bde578 + 1ab65ed commit 83b3158
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/transaction_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,19 @@ pub fn store_transfer<S: Storage>(
};
let tx = StoredRichTx::from_stored_legacy_transfer(transfer.clone());

if owner != sender {
// Write to the owners history if it's different from the other two addresses
if owner != sender && owner != receiver {
cosmwasm_std::debug_print("saving transaction history for owner");
append_tx(store, &tx, owner)?;
append_transfer(store, &transfer, owner)?;
}
cosmwasm_std::debug_print("saving transaction history for sender");
append_tx(store, &tx, sender)?;
append_transfer(store, &transfer, sender)?;
// Write to the sender's history if it's different from the receiver
if sender != receiver {
cosmwasm_std::debug_print("saving transaction history for sender");
append_tx(store, &tx, sender)?;
append_transfer(store, &transfer, sender)?;
}
// Always write to the recipient's history
cosmwasm_std::debug_print("saving transaction history for receiver");
append_tx(store, &tx, receiver)?;
append_transfer(store, &transfer, receiver)?;
Expand Down

0 comments on commit 83b3158

Please sign in to comment.