MCPcopy Create free account
hub / github.com/ElementsProject/lightning / tell_lightningd_lease_rates

Function tell_lightningd_lease_rates

plugins/funder.c:1049–1082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047};
1048
1049static void tell_lightningd_lease_rates(struct plugin *p,
1050 struct lease_rates *rates)
1051{
1052 struct json_out *jout;
1053 struct amount_msat mval;
1054
1055 /* Tell lightningd with our lease rates*/
1056 jout = json_out_new(NULL);
1057 json_out_start(jout, NULL, '{');
1058
1059 mval = amount_msat(rates->lease_fee_base_sat * 1000);
1060 json_out_addstr(jout, "lease_fee_base_msat",
1061 type_to_string(tmpctx, struct amount_msat, &mval));
1062 json_out_add(jout, "lease_fee_basis", false,
1063 "%d", rates->lease_fee_basis);
1064
1065 json_out_add(jout, "funding_weight", false,
1066 "%d", rates->funding_weight);
1067
1068 mval = amount_msat(rates->channel_fee_max_base_msat);
1069 json_out_addstr(jout, "channel_fee_max_base_msat",
1070 type_to_string(tmpctx, struct amount_msat, &mval));
1071 json_out_add(jout, "channel_fee_max_proportional_thousandths", false,
1072 "%d", rates->channel_fee_max_proportional_thousandths);
1073
1074 json_out_end(jout, '}');
1075 json_out_finished(jout);
1076
1077 rpc_scan(p, "setleaserates", take(jout),
1078 /* Unused */
1079 "{lease_fee_base_msat:%}",
1080 JSON_SCAN(json_to_msat, &mval));
1081
1082}
1083
1084#if DEVELOPER
1085static void memleak_mark(struct plugin *p, struct htable *memtable)

Callers 1

initFunction · 0.85

Calls 9

json_out_newFunction · 0.85
json_out_startFunction · 0.85
json_out_addstrFunction · 0.85
json_out_addFunction · 0.85
json_out_endFunction · 0.85
json_out_finishedFunction · 0.85
rpc_scanFunction · 0.85
amount_msatClass · 0.70
type_to_stringClass · 0.50

Tested by

no test coverage detected