]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Onion message fuzzer: update held_htlc_available handling
authorValentine Wallace <vwallace@protonmail.com>
Tue, 25 Jun 2024 19:51:03 +0000 (15:51 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Tue, 25 Jun 2024 19:51:05 +0000 (15:51 -0400)
Fuzzers should always do more, not less. Post-merge feedback on
e8f154dd3c299c7988762909df48b0c9d919d6f8.

fuzz/src/onion_message.rs

index ba76815af59cb6b88226ca45c5fede1e38b624f7..e60d13d57a90aea5a18c13454a0f432c21fce3cb 100644 (file)
@@ -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<Responder>,
+               &self, message: HeldHtlcAvailable, responder: Option<Responder>,
        ) -> ResponseInstruction<ReleaseHeldHtlc> {
-               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) {}
 }