Skip to content

Amount serialization issue with cln-rpc #9283

Description

@daywalker90

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions