When you let cln-rpc serialize an Amount it does so as a string with a msat suffix: 1000msat.
This kind of serialization was removed in the "The Great Msat Purge" but has survived in cln-rpc and causes the json schema validator to throw an error if you test a plugin that serializes an Amount.
Changing cln-rpc to serialize an Amount as a raw number is problematic though. This is because we also mapped the json schema type sat to the rust type Amount. And some rpc inputs expect satoshi amounts. For example fundchannel. With the current string representation CLN parses this correctly, but if you pass a raw number where CLN expects a satoshi unit you will get a unit mismatch and your new channel is 1000x the size you desired.
We should definitely have cln-rpc serialize amounts in the same way CLN does, but also have no confusion as to what unit an Amount represents.
When you let
cln-rpcserialize anAmountit does so as a string with a msat suffix:1000msat.This kind of serialization was removed in the "The Great Msat Purge" but has survived in
cln-rpcand causes the json schema validator to throw an error if you test a plugin that serializes anAmount.Changing
cln-rpcto serialize anAmountas a raw number is problematic though. This is because we also mapped the json schema typesatto the rust typeAmount. And some rpc inputs expect satoshi amounts. For examplefundchannel. With the current string representation CLN parses this correctly, but if you pass a raw number where CLN expects a satoshi unit you will get a unit mismatch and your new channel is 1000x the size you desired.We should definitely have
cln-rpcserialize amounts in the same way CLN does, but also have no confusion as to what unit anAmountrepresents.