From: Valentine Wallace Date: Tue, 25 Jun 2024 19:51:03 +0000 (-0400) Subject: Onion message fuzzer: update held_htlc_available handling X-Git-Tag: v0.0.124-beta~69^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=07b4cb626510619409f5b0dd4083b097fdb8485e;p=rust-lightning Onion message fuzzer: update held_htlc_available handling Fuzzers should always do more, not less. Post-merge feedback on e8f154dd3c299c7988762909df48b0c9d919d6f8. --- diff --git a/fuzz/src/onion_message.rs b/fuzz/src/onion_message.rs index ba76815af..e60d13d57 100644 --- a/fuzz/src/onion_message.rs +++ b/fuzz/src/onion_message.rs @@ -13,7 +13,7 @@ use lightning::ln::script::ShutdownScript; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::async_payments::{ - AsyncPaymentsMessage, AsyncPaymentsMessageHandler, HeldHtlcAvailable, ReleaseHeldHtlc, + AsyncPaymentsMessageHandler, HeldHtlcAvailable, ReleaseHeldHtlc, }; use lightning::onion_message::messenger::{ CustomOnionMessageHandler, Destination, MessageRouter, OnionMessagePath, OnionMessenger, @@ -114,9 +114,14 @@ struct TestAsyncPaymentsMessageHandler {} impl AsyncPaymentsMessageHandler for TestAsyncPaymentsMessageHandler { fn held_htlc_available( - &self, _message: HeldHtlcAvailable, _responder: Option, + &self, message: HeldHtlcAvailable, responder: Option, ) -> ResponseInstruction { - ResponseInstruction::NoResponse + let responder = match responder { + Some(resp) => resp, + None => return ResponseInstruction::NoResponse, + }; + responder + .respond(ReleaseHeldHtlc { payment_release_secret: message.payment_release_secret }) } fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {} }