X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchanmon_update_fail_tests.rs;h=e59cf47f17600963c9852389fc5723d8189816ef;hb=6aca7e1c4db17f43b79504fd44b942b4bc08db9d;hp=3f210cb46c535dfb433575d558740882f4446cd3;hpb=ec3aa494953c7d720370119f673e8e6b3a2155d5;p=rust-lightning diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs index 3f210cb4..e59cf47f 100644 --- a/lightning/src/ln/chanmon_update_fail_tests.rs +++ b/lightning/src/ln/chanmon_update_fail_tests.rs @@ -12,7 +12,6 @@ //! There are a bunch of these as their handling is relatively error-prone so they are split out //! here. See also the chanmon_fail_consistency fuzz test. -use bitcoin::blockdata::block::{Block, BlockHeader}; use bitcoin::blockdata::constants::genesis_block; use bitcoin::hash_types::BlockHash; use bitcoin::network::constants::Network; @@ -35,7 +34,6 @@ use crate::util::test_utils; use crate::io; use bitcoin::hashes::Hash; -use bitcoin::TxMerkleNode; use crate::prelude::*; use crate::sync::{Arc, Mutex}; @@ -121,15 +119,7 @@ fn test_monitor_and_persister_update_fail() { assert_eq!(chain_mon.watch_channel(outpoint, new_monitor), ChannelMonitorUpdateStatus::Completed); chain_mon }; - let header = BlockHeader { - version: 0x20000000, - prev_blockhash: BlockHash::all_zeros(), - merkle_root: TxMerkleNode::all_zeros(), - time: 42, - bits: 42, - nonce: 42 - }; - chain_mon.chain_monitor.block_connected(&Block { header, txdata: vec![] }, 200); + chain_mon.chain_monitor.block_connected(&create_dummy_block(BlockHash::all_zeros(), 42, Vec::new()), 200); // Set the persister's return value to be a InProgress. persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress); @@ -146,7 +136,7 @@ fn test_monitor_and_persister_update_fail() { let mut node_0_per_peer_lock; let mut node_0_peer_state_lock; let mut channel = get_channel_ref!(nodes[0], nodes[1], node_0_per_peer_lock, node_0_peer_state_lock, chan.2); - if let Ok(update) = channel.commitment_signed(&updates.commitment_signed, &node_cfgs[0].logger) { + if let Ok(Some(update)) = channel.commitment_signed(&updates.commitment_signed, &node_cfgs[0].logger) { // Check that even though the persister is returning a InProgress, // because the update is bogus, ultimately the error that's returned // should be a PermanentFailure.