Fix wallet export rescan height
It would return the latest transaction height rather than the earliest :S
This commit is contained in:
parent
1c76084db8
commit
e9bbb8724f
@ -134,15 +134,11 @@ impl FullyNodedExport {
|
|||||||
let blockheight = match wallet.database.borrow().iter_txs(false) {
|
let blockheight = match wallet.database.borrow().iter_txs(false) {
|
||||||
_ if !include_blockheight => 0,
|
_ if !include_blockheight => 0,
|
||||||
Err(_) => 0,
|
Err(_) => 0,
|
||||||
Ok(txs) => {
|
Ok(txs) => txs
|
||||||
let mut heights = txs
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx| tx.confirmation_time.map(|c| c.height).unwrap_or(0))
|
.filter_map(|tx| tx.confirmation_time.map(|c| c.height))
|
||||||
.collect::<Vec<_>>();
|
.min()
|
||||||
heights.sort_unstable();
|
.unwrap_or(0),
|
||||||
|
|
||||||
*heights.last().unwrap_or(&0)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let export = FullyNodedExport {
|
let export = FullyNodedExport {
|
||||||
@ -249,6 +245,22 @@ mod test {
|
|||||||
fee: Some(500),
|
fee: Some(500),
|
||||||
confirmation_time: Some(BlockTime {
|
confirmation_time: Some(BlockTime {
|
||||||
timestamp: 12345678,
|
timestamp: 12345678,
|
||||||
|
height: 5001,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
db.set_tx(&TransactionDetails {
|
||||||
|
transaction: None,
|
||||||
|
txid: Txid::from_str(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
received: 25_000,
|
||||||
|
sent: 0,
|
||||||
|
fee: Some(300),
|
||||||
|
confirmation_time: Some(BlockTime {
|
||||||
|
timestamp: 12345677,
|
||||||
height: 5000,
|
height: 5000,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user