Skip to content

error: mismatched types (event.rs) #289

@reez

Description

@reez

when cargo build getting error:

error[E0308]: mismatched types
   --> src/event.rs:709:5
    |
335 | /         match event {
336 | |             LdkEvent::FundingGenerationReady {
337 | |                 temporary_channel_id,
338 | |                 counterparty_node_id,
...   |
709 | |                 self.output_sweeper.track_spendable_outputs(outputs, channel_id, true, None)
    | |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), ()>`
...   |
920 | |             LdkEvent::ConnectionNeeded { .. } => {},
921 | |         }
    | |_________- expected this to be `()`
    |
    = note: expected unit type `()`
                    found enum `Result<(), ()>`
help: consider using a semicolon here
    |
709 |                 self.output_sweeper.track_spendable_outputs(outputs, channel_id, true, None);
    |                                                                                             +
help: consider using a semicolon here
    |
921 |         };
    |          +
help: consider using `Result::expect` to unwrap the `Result<(), ()>` value, panicking if the value is a `Result::Err`
    |
709 |                 self.output_sweeper.track_spendable_outputs(outputs, channel_id, true, None).expect("REASON")
    |                                                                                             +++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `ldk-node` (lib) due to 1 previous error

Applying the suggested fix go cargo build to finish successfully, and just generated this warning:

warning: unused `Result` that must be used
   --> src/io/utils.rs:266:3
    |
266 | ...   sweeper.track_spendable_outputs(descriptors, output.channel_id, true, spend_dela...
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
266 |         let _ = sweeper.track_spendable_outputs(descriptors, output.channel_id, true, spend_delay);
    |         +++++++

warning: `ldk-node` (lib) generated 1 warning

Wondering if you are seeing the same error?

Tested on existing fork, as well as a fresh clone, both on branch main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions