get the position for incoming mempool txids
This commit is contained in:
@@ -953,11 +953,11 @@ impl LightClient {
|
||||
wtxs.iter().flat_map(|wtx| {
|
||||
wtx.incoming_metadata.iter()
|
||||
.enumerate()
|
||||
.map(move |(_i, om)|
|
||||
.map(move |(i, om)|
|
||||
object! {
|
||||
"block_height" => wtx.block.clone(),
|
||||
"datetime" => wtx.datetime.clone(),
|
||||
"position" => om.position,
|
||||
"position" => i,
|
||||
"txid" => format!("{}", wtx.txid),
|
||||
"amount" => om.value as i64,
|
||||
"address" => om.address.clone(),
|
||||
|
||||
@@ -1562,20 +1562,20 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
return;
|
||||
}
|
||||
|
||||
let position = if formatted_memo.as_ref().map_or(false, |m| m.starts_with('{')) {
|
||||
/*let position = if formatted_memo.as_ref().map_or(false, |m| m.starts_with('{')) {
|
||||
1
|
||||
} else {
|
||||
existing_txs.iter()
|
||||
.filter(|tx| !LightWallet::memo_str(&Some(tx.incoming_metadata.iter().last().unwrap().memo.clone())).as_ref().map_or(false, |m| m.starts_with('{')))
|
||||
.count() as u64 + 2
|
||||
};
|
||||
};*/
|
||||
|
||||
let incoming_metadata = IncomingTxMetadata {
|
||||
address: addr.clone(),
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
};
|
||||
|
||||
wtx.incoming_metadata.push(incoming_metadata);
|
||||
@@ -1595,7 +1595,7 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
});
|
||||
} else {
|
||||
let mut new_wtx = WalletTx::new(height, now() as u64, &tx.txid());
|
||||
@@ -1604,14 +1604,14 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
});
|
||||
txs.insert(tx.txid(), new_wtx);
|
||||
}
|
||||
|
||||
info!("Successfully added txid with memo");
|
||||
} else {
|
||||
let position = 0;
|
||||
// let position = 0;
|
||||
|
||||
// Check if txid already exists in the hashmap
|
||||
let txid_exists = match self.txs.read() {
|
||||
@@ -1633,7 +1633,7 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
};
|
||||
|
||||
wtx.incoming_metadata.push(incoming_metadata);
|
||||
@@ -1653,7 +1653,7 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
});
|
||||
} else {
|
||||
let mut new_wtx = WalletTx::new(height, now() as u64, &tx.txid());
|
||||
@@ -1662,7 +1662,7 @@ pub fn scan_full_mempool_tx(&self, tx: &Transaction, height: i32, _datetime: u64
|
||||
value: amt,
|
||||
memo: memo.clone(),
|
||||
incoming_mempool: true,
|
||||
position: position,
|
||||
// position: position,
|
||||
});
|
||||
txs.insert(tx.txid(), new_wtx);
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ pub struct IncomingTxMetadata {
|
||||
pub value : u64,
|
||||
pub memo : Memo,
|
||||
pub incoming_mempool: bool,
|
||||
pub position: u64,
|
||||
// pub position: u64,
|
||||
}
|
||||
|
||||
impl IncomingTxMetadata {
|
||||
@@ -378,7 +378,7 @@ impl IncomingTxMetadata {
|
||||
|
||||
let value = reader.read_u64::<LittleEndian>()?;
|
||||
let incoming_mempool = true;
|
||||
let position = 0;
|
||||
// let position = 0;
|
||||
|
||||
let mut memo_bytes = [0u8; 512];
|
||||
reader.read_exact(&mut memo_bytes)?;
|
||||
@@ -389,7 +389,7 @@ impl IncomingTxMetadata {
|
||||
value,
|
||||
memo,
|
||||
incoming_mempool,
|
||||
position,
|
||||
// position,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user