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

Function param_feerate_unchecked

lightningd/feerate.c:49–114  ·  view source on GitHub ↗

This can set **feerate to 0, if it's unknown. */

Source from the content-addressed store, hash-verified

47
48/* This can set **feerate to 0, if it's unknown. */
49static struct command_result *param_feerate_unchecked(struct command *cmd,
50 const char *name,
51 const char *buffer,
52 const jsmntok_t *tok,
53 u32 **feerate)
54{
55 *feerate = tal(cmd, u32);
56
57 if (json_tok_streq(buffer, tok, "opening")) {
58 **feerate = opening_feerate(cmd->ld->topology);
59 return NULL;
60 }
61 if (json_tok_streq(buffer, tok, "mutual_close")) {
62 **feerate = mutual_close_feerate(cmd->ld->topology);
63 return NULL;
64 }
65 if (json_tok_streq(buffer, tok, "penalty")) {
66 **feerate = penalty_feerate(cmd->ld->topology);
67 return NULL;
68 }
69 if (json_tok_streq(buffer, tok, "unilateral_close")) {
70 **feerate = unilateral_feerate(cmd->ld->topology, false);
71 return NULL;
72 }
73 if (json_tok_streq(buffer, tok, "unilateral_anchor_close")) {
74 **feerate = unilateral_feerate(cmd->ld->topology, true);
75 return NULL;
76 }
77
78 /* We used SLOW, NORMAL, and URGENT as feerate targets previously,
79 * and many commands rely on this syntax now.
80 * It's also really more natural for an user interface. */
81 if (json_tok_streq(buffer, tok, "slow")) {
82 **feerate = feerate_for_deadline(cmd->ld->topology, 100);
83 return NULL;
84 } else if (json_tok_streq(buffer, tok, "normal")) {
85 **feerate = feerate_for_deadline(cmd->ld->topology, 12);
86 return NULL;
87 } else if (json_tok_streq(buffer, tok, "urgent")) {
88 **feerate = feerate_for_deadline(cmd->ld->topology, 6);
89 return NULL;
90 } else if (json_tok_streq(buffer, tok, "minimum")) {
91 **feerate = get_feerate_floor(cmd->ld->topology);
92 return NULL;
93 }
94
95 /* Can specify number of blocks as a target */
96 if (json_tok_endswith(buffer, tok, "blocks")) {
97 jsmntok_t base = *tok;
98 base.end -= strlen("blocks");
99 u32 numblocks;
100
101 if (!json_to_number(buffer, &base, &numblocks)) {
102 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
103 "'%s' should be an integer not '%.*s'",
104 name, base.end - base.start,
105 buffer + base.start);
106 }

Callers 1

param_feerateFunction · 0.85

Calls 12

json_tok_streqFunction · 0.85
json_tok_endswithFunction · 0.85
tal_freeFunction · 0.85
param_feerate_valFunction · 0.85
opening_feerateFunction · 0.70
mutual_close_feerateFunction · 0.70
penalty_feerateFunction · 0.70
unilateral_feerateFunction · 0.70
feerate_for_deadlineFunction · 0.70
get_feerate_floorFunction · 0.70
command_failFunction · 0.70
json_to_numberFunction · 0.50

Tested by

no test coverage detected