mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
cln: Fix routehints conversion from cln-rpc and cln-grpc
Fixes #6143 Changelog-Fixed: clnrs: Fixed an issue converting routehints in keysend
This commit is contained in:
parent
b42984afe1
commit
6d76642f7e
@ -652,16 +652,62 @@ pub struct Routehop {
|
||||
pub expirydelta: u16,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Routehint {
|
||||
pub hops: Vec<Routehop>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RoutehintList {
|
||||
pub hints: Vec<Routehint>,
|
||||
}
|
||||
|
||||
use serde::ser::SerializeSeq;
|
||||
|
||||
impl Serialize for Routehint {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut seq = serializer.serialize_seq(Some(self.hops.len()))?;
|
||||
for e in self.hops.iter() {
|
||||
seq.serialize_element(e)?;
|
||||
}
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for RoutehintList {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut seq = serializer.serialize_seq(Some(self.hints.len()))?;
|
||||
for e in self.hints.iter() {
|
||||
seq.serialize_element(e)?;
|
||||
}
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for RoutehintList {
|
||||
fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
todo!("Required once we roundtrip, but not necessary for cln-rpc itself")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Routehint {
|
||||
fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
todo!("Required once we roundtrip, but not necessary for cln-rpc itself")
|
||||
}
|
||||
}
|
||||
|
||||
/// An error returned by the lightningd RPC consisting of a code and a
|
||||
/// message
|
||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||
|
@ -249,7 +249,6 @@ def test_grpc_wrong_auth(node_factory):
|
||||
stub.Getinfo(nodepb.GetinfoRequest())
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_grpc_keysend_routehint(bitcoind, node_factory):
|
||||
"""The routehints are a bit special, test that conversions work.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user