Allow get_shutdown_scriptpubkey and get_destination_script to return an error
[rust-lightning] / lightning / src / util / test_utils.rs
index 679652b2da49402a2c76f2f0720407c0928e043b..a6d83e4563f7b02c61c57c67fd51988f6e6cdb96 100644 (file)
@@ -171,8 +171,8 @@ impl SignerProvider for OnlyReadsKeysInterface {
                ))
        }
 
-       fn get_destination_script(&self) -> Script { unreachable!(); }
-       fn get_shutdown_scriptpubkey(&self) -> ShutdownScript { unreachable!(); }
+       fn get_destination_script(&self) -> Result<Script, ()> { Err(()) }
+       fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> { Err(()) }
 }
 
 pub struct TestChainMonitor<'a> {
@@ -793,14 +793,14 @@ impl SignerProvider for TestKeysInterface {
                ))
        }
 
-       fn get_destination_script(&self) -> Script { self.backing.get_destination_script() }
+       fn get_destination_script(&self) -> Result<Script, ()> { self.backing.get_destination_script() }
 
-       fn get_shutdown_scriptpubkey(&self) -> ShutdownScript {
+       fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> {
                match &mut *self.expectations.lock().unwrap() {
                        None => self.backing.get_shutdown_scriptpubkey(),
                        Some(expectations) => match expectations.pop_front() {
                                None => panic!("Unexpected get_shutdown_scriptpubkey"),
-                               Some(expectation) => expectation.returns,
+                               Some(expectation) => Ok(expectation.returns),
                        },
                }
        }