Add a feerate, but don't publish one that bitcoind won't accept. */
| 499 | |
| 500 | /* Add a feerate, but don't publish one that bitcoind won't accept. */ |
| 501 | static void json_add_feerate(struct json_stream *result, const char *fieldname, |
| 502 | struct command *cmd, |
| 503 | u64 perkb_floor, |
| 504 | u64 value) |
| 505 | { |
| 506 | /* Anthony Towns reported signet had a 900kbtc fee block, and then |
| 507 | * CLN got upset scanning feerate. It expects a u32. */ |
| 508 | if (value > 0xFFFFFFFF) { |
| 509 | plugin_log(cmd->plugin, LOG_UNUSUAL, |
| 510 | "Feerate %"PRIu64" is ridiculous: trimming to 32 bits", |
| 511 | value); |
| 512 | value = 0xFFFFFFFF; |
| 513 | } |
| 514 | /* 0 is special, it means "unknown" */ |
| 515 | if (value && value < perkb_floor) { |
| 516 | plugin_log(cmd->plugin, LOG_DBG, |
| 517 | "Feerate %s raised from %"PRIu64 |
| 518 | " perkb to floor of %"PRIu64, |
| 519 | fieldname, value, perkb_floor); |
| 520 | json_add_u64(result, fieldname, perkb_floor); |
| 521 | } else { |
| 522 | json_add_u64(result, fieldname, value); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | /* Get the feerate floor from getmempoolinfo. |
| 527 | * Returns NULL on success (floor stored in *perkb_floor), or error response. */ |
no test coverage detected