| 495 | } |
| 496 | |
| 497 | static struct command_result * |
| 498 | estimatefees_parse_feerate(struct bitcoin_cli *bcli, u64 *feerate) |
| 499 | { |
| 500 | const jsmntok_t *tokens; |
| 501 | |
| 502 | tokens = json_parse_simple(bcli->output, |
| 503 | bcli->output, bcli->output_bytes); |
| 504 | if (!tokens) { |
| 505 | return command_err_bcli_badjson(bcli, "cannot parse"); |
| 506 | } |
| 507 | |
| 508 | if (json_scan(tmpctx, bcli->output, tokens, "{feerate:%}", |
| 509 | JSON_SCAN(json_to_bitcoin_amount, feerate)) != NULL) { |
| 510 | /* Paranoia: if it had a feerate, but was malformed: */ |
| 511 | if (json_get_member(bcli->output, tokens, "feerate")) |
| 512 | return command_err_bcli_badjson(bcli, "cannot scan"); |
| 513 | /* Regtest fee estimation is generally awful: Fake it at min. */ |
| 514 | if (bitcoind->fake_fees) { |
| 515 | *feerate = 1000; |
| 516 | return NULL; |
| 517 | } |
| 518 | /* We return null if estimation failed, and bitcoin-cli will |
| 519 | * exit with 0 but no feerate field on failure. */ |
| 520 | return estimatefees_null_response(bcli); |
| 521 | } |
| 522 | |
| 523 | return NULL; |
| 524 | } |
| 525 | |
| 526 | static struct command_result *process_sendrawtransaction(struct bitcoin_cli *bcli) |
| 527 | { |
no test coverage detected