lightning icon indicating copy to clipboard operation
lightning copied to clipboard

cln-rpc: missing field `received_time`

Open daywalker90 opened this issue 1 year ago • 2 comments

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

daywalker90 avatar Mar 17 '24 19:03 daywalker90

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

BitcoinJiuJitsu avatar Jun 26 '24 06:06 BitcoinJiuJitsu

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

Sjors avatar Jun 27 '24 07:06 Sjors