Rollback witness test

This commit is contained in:
Aditya Kulkarni 2019-10-06 13:49:24 -07:00
parent f0f7684346
commit 11c409ec7c

View File

@ -2759,10 +2759,22 @@ pub mod tests {
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
assert_eq!(wallet.last_scanned_height(), 6);
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 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].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