Skip to content

Commit

Permalink
Merge pull request #648 from AloeareV/only_add_to_empty_metadata
Browse files Browse the repository at this point in the history
Only add outgoing metadata when empty to begin with
  • Loading branch information
fluidvanadium authored Nov 1, 2023
2 parents 8cd3b3b + 0d62116 commit d6efd1e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions zingolib/src/wallet/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,16 +862,10 @@ impl TransactionMetadataSet {
pub fn add_outgoing_metadata(&mut self, txid: &TxId, outgoing_metadata: Vec<OutgoingTxData>) {
// println!(" adding outgoing metadata to txid {}", txid);
if let Some(transaction_metadata) = self.current.get_mut(txid) {
for outgoing_metadatum in outgoing_metadata {
if !transaction_metadata
if transaction_metadata.outgoing_tx_data.is_empty() {
transaction_metadata
.outgoing_tx_data
.iter()
.any(|known_metadatum| *known_metadatum == outgoing_metadatum)
{
transaction_metadata
.outgoing_tx_data
.push(outgoing_metadatum);
}
.extend(outgoing_metadata);
}
} else {
error!(
Expand Down

0 comments on commit d6efd1e

Please sign in to comment.