mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
common: add check that pico-valued invoices are round numbers.
Otherwise you can ask for a sub-millisatoshi amount, which is dumb and violates the spec. See-also: https://github.com/lightningnetwork/lightning-rfc/pull/736 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: We now reject invoices which ask for sub-millisatoshi amounts
This commit is contained in:
committed by
Christian Decker
parent
3e9d4de02e
commit
5d2fdfe66b
@@ -562,6 +562,13 @@ int main(void)
|
||||
assert(!bolt11_decode(tmpctx, "lnbc2500x1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpujr6jxr9gq9pv6g46y7d20jfkegkg4gljz2ea2a3m9lmvvr95tq2s0kvu70u3axgelz3kyvtp2ywwt0y8hkx2869zq5dll9nelr83zzqqpgl2zg", NULL, &fail));
|
||||
assert(streq(fail, "Invalid amount postfix 'x'"));
|
||||
|
||||
/* BOLT- #11:
|
||||
* > ### Invalid sub-millisatoshi precision.
|
||||
* > lnbc2500000001p1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpu7hqtk93pkf7sw55rdv4k9z2vj050rxdr6za9ekfs3nlt5lr89jqpdmxsmlj9urqumg0h9wzpqecw7th56tdms40p2ny9q4ddvjsedzcplva53s
|
||||
*/
|
||||
assert(!bolt11_decode(tmpctx, "lnbc2500000001p1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpu7hqtk93pkf7sw55rdv4k9z2vj050rxdr6za9ekfs3nlt5lr89jqpdmxsmlj9urqumg0h9wzpqecw7th56tdms40p2ny9q4ddvjsedzcplva53s", NULL, &fail));
|
||||
assert(streq(fail, "Invalid sub-millisatoshi amount '2500000001p'"));
|
||||
|
||||
/* FIXME: Test the others! */
|
||||
wally_cleanup(0);
|
||||
tal_free(tmpctx);
|
||||
|
||||
Reference in New Issue
Block a user