mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
pyln-client: convert every _msat field to Millisatoshi
This prepares for when they start being u64, not strings with msat appended. This has a strange side effect on our schema: despite the name, decodepay's `fee_base_msat` is actually a u64, which we now convert to msat on decode. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
01411d70be
commit
5c208c1b06
@ -453,11 +453,10 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
if isinstance(obj, dict):
|
||||
for k, v in obj.items():
|
||||
if k.endswith('msat'):
|
||||
if isinstance(v, str) and v.endswith('msat'):
|
||||
obj[k] = Millisatoshi(v)
|
||||
# Special case for array of msat values
|
||||
elif isinstance(v, list) and all(isinstance(e, str) and e.endswith('msat') for e in v):
|
||||
if isinstance(v, list):
|
||||
obj[k] = [Millisatoshi(e) for e in v]
|
||||
else:
|
||||
obj[k] = Millisatoshi(v)
|
||||
else:
|
||||
obj[k] = LightningRpc.LightningJSONDecoder.replace_amounts(v)
|
||||
elif isinstance(obj, list):
|
||||
|
@ -356,7 +356,7 @@ def _extra_validator(is_request: bool):
|
||||
return False
|
||||
|
||||
def is_msat_response(checker, instance):
|
||||
"""String number ending in msat"""
|
||||
"""String number ending in msat (deprecated) or integer"""
|
||||
return type(instance) is Millisatoshi
|
||||
|
||||
def is_txid(checker, instance):
|
||||
|
@ -38,7 +38,7 @@ On success, an object is returned, containing:
|
||||
- hops in the route:
|
||||
- **pubkey** (pubkey): the public key of the node
|
||||
- **short_channel_id** (short_channel_id): a channel to the next peer
|
||||
- **fee_base_msat** (u32): the base fee for payments
|
||||
- **fee_base_msat** (msat): the base fee for payments
|
||||
- **fee_proportional_millionths** (u32): the parts-per-million fee for payments
|
||||
- **cltv_expiry_delta** (u32): the CLTV delta across this hop
|
||||
- **extra** (array of objects, optional): Any extra fields we didn't know how to parse:
|
||||
@ -70,4 +70,4 @@ RESOURCES
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:17cb6c66c75e907f3a2583d702aec2fc6e5a7b6026d05a3ed9957304799c9aef)
|
||||
[comment]: # ( SHA256STAMP:a606b0d0594d48c619a8d34c7c0d0996982db10f1423841f269e89004a19fa98)
|
||||
|
@ -132,7 +132,7 @@
|
||||
"description": "a channel to the next peer"
|
||||
},
|
||||
"fee_base_msat": {
|
||||
"type": "u32",
|
||||
"type": "msat",
|
||||
"description": "the base fee for payments"
|
||||
},
|
||||
"fee_proportional_millionths": {
|
||||
|
Loading…
Reference in New Issue
Block a user