Rollback witness test
This commit is contained in:
@@ -2759,10 +2759,22 @@ pub mod tests {
|
|||||||
|
|
||||||
add_blocks(&wallet, 2, 5, block_hash).unwrap();
|
add_blocks(&wallet, 2, 5, block_hash).unwrap();
|
||||||
|
|
||||||
|
// Make sure the note exists with the witnesses
|
||||||
|
{
|
||||||
|
let txs = wallet.txs.read().unwrap();
|
||||||
|
assert_eq!(txs[&txid1].notes[0].witnesses.len(), 7);
|
||||||
|
}
|
||||||
|
|
||||||
// Invalidate 2 blocks
|
// Invalidate 2 blocks
|
||||||
assert_eq!(wallet.last_scanned_height(), 6);
|
assert_eq!(wallet.last_scanned_height(), 6);
|
||||||
assert_eq!(wallet.invalidate_block(5), 2);
|
assert_eq!(wallet.invalidate_block(5), 2);
|
||||||
|
|
||||||
|
// THe witnesses should be rolledback
|
||||||
|
{
|
||||||
|
let txs = wallet.txs.read().unwrap();
|
||||||
|
assert_eq!(txs[&txid1].notes[0].witnesses.len(), 5);
|
||||||
|
}
|
||||||
|
|
||||||
let blk3_hash;
|
let blk3_hash;
|
||||||
let blk4_hash;
|
let blk4_hash;
|
||||||
{
|
{
|
||||||
@@ -2817,6 +2829,7 @@ pub mod tests {
|
|||||||
assert_eq!(txs[&sent_txid].notes[0].is_change, true);
|
assert_eq!(txs[&sent_txid].notes[0].is_change, true);
|
||||||
assert_eq!(txs[&sent_txid].notes[0].spent, None);
|
assert_eq!(txs[&sent_txid].notes[0].spent, None);
|
||||||
assert_eq!(txs[&sent_txid].notes[0].unconfirmed_spent, None);
|
assert_eq!(txs[&sent_txid].notes[0].unconfirmed_spent, None);
|
||||||
|
assert_eq!(txs[&sent_txid].notes[0].witnesses.len(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalidate 3 blocks
|
// Invalidate 3 blocks
|
||||||
|
|||||||
Reference in New Issue
Block a user