ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.81k stars 887 forks source link

cln-rpc: missing field `received_time` #7157

Open daywalker90 opened 5 months ago

daywalker90 commented 5 months ago

In one of my plugins a user got an error that should not happen imo: https://github.com/daywalker90/summars/issues/9

I call listforwards like this in my plugin:

list_forwards(
        rpc_path,
        Some(ListforwardsStatus::SETTLED),
        None,
        None,
        Some(ListforwardsIndex::CREATED),
        Some(fw_index.start),
        None,
    )
    .await?
pub async fn list_forwards(
    rpc_path: &PathBuf,
    status: Option<ListforwardsStatus>,
    in_channel: Option<ShortChannelId>,
    out_channel: Option<ShortChannelId>,
    index: Option<ListforwardsIndex>,
    start: Option<u64>,
    limit: Option<u32>,
) -> Result<ListforwardsResponse, Error> {
    let mut rpc = ClnRpc::new(&rpc_path).await?;
    let listforwards_request = rpc
        .call(Request::ListForwards(ListforwardsRequest {
            status,
            in_channel,
            out_channel,
            index,
            start,
            limit,
        }))
        .await
        .map_err(|e| anyhow!("Error calling list_forwards: {}", e.to_string()))?;
    match listforwards_request {
        Response::ListForwards(info) => Ok(info),
        e => Err(anyhow!("Unexpected result in list_forwards: {:?}", e)),
    }
}

and he got a

"Error calling list_forwards: Error: Failed to deserialize response : missing field `received_time`"

The schema says that received_time is required. So i don't know how this can happen. He uses cln 24.02.1 and i use cln-rpc 0.1.8

BitcoinJiuJitsu commented 2 months ago

Open CLN bounty on this: https://community.sphinx.chat/p/clt2n32tu2rjujq1jn6g/bounties/2158/2

Sjors commented 2 months ago

It could probably return unix timestamp 0 for these really old records? I ran into this myself, and just ended up deleting those old forwards.

lightning-cli listforwards | jq -r '.forwards|  map(select(.received_time == null)) | .[] | "\(.in_channel) \(.in_htlc_id) \(.status)"' | xargs -l1 lightning-cli delforward