mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
common/iso4217: make find_iso4217 a little more usable.
We often have the currency as a tal string. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
d971e3de98
commit
0f2c9cf5d5
@@ -112,14 +112,14 @@ static bool print_amount(const struct bitcoin_blkid *chains,
|
||||
minor_unit = 11;
|
||||
} else {
|
||||
const struct iso4217_name_and_divisor *iso;
|
||||
currency = tal_strndup(tmpctx, iso4217, tal_bytelen(iso4217));
|
||||
iso = find_iso4217(currency);
|
||||
if (iso)
|
||||
iso = find_iso4217(iso4217, tal_bytelen(iso4217));
|
||||
if (iso) {
|
||||
minor_unit = iso->minor_unit;
|
||||
else {
|
||||
currency = iso->name;
|
||||
} else {
|
||||
minor_unit = 0;
|
||||
currency = tal_fmt(tmpctx, "%s (UNKNOWN CURRENCY)",
|
||||
currency);
|
||||
currency = tal_fmt(tmpctx, "%.*s (UNKNOWN CURRENCY)",
|
||||
(int)tal_bytelen(iso4217), iso4217);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user