From 9d37b7808807df1067818f970ddc0fa31a377968 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 24 Aug 2018 11:49:13 +0930 Subject: [PATCH] cleanup: lowercase name of feerates, immediate -> urgent. This is only used for logging now, but it gets more important as it enters the RPC API. Signed-off-by: Rusty Russell --- lightningd/chaintopology.c | 8 ++++++-- lightningd/chaintopology.h | 2 +- lightningd/channel_control.c | 2 +- lightningd/peer_control.c | 2 +- tests/test_closing.py | 2 +- tests/test_connection.py | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 0724b36ad..f32dc4e31 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -278,8 +278,12 @@ static void watch_for_utxo_reconfirmation(struct chain_topology *topo, static const char *feerate_name(enum feerate feerate) { - return feerate == FEERATE_IMMEDIATE ? "Immediate" - : feerate == FEERATE_NORMAL ? "Normal" : "Slow"; + switch (feerate) { + case FEERATE_URGENT: return "urgent"; + case FEERATE_NORMAL: return "normal"; + case FEERATE_SLOW: return "slow"; + } + abort(); } /* Mutual recursion via timer. */ diff --git a/lightningd/chaintopology.h b/lightningd/chaintopology.h index ae12cc53e..2c8650a72 100644 --- a/lightningd/chaintopology.h +++ b/lightningd/chaintopology.h @@ -20,7 +20,7 @@ struct peer; struct txwatch; enum feerate { - FEERATE_IMMEDIATE, /* Aka: aim for next block. */ + FEERATE_URGENT, /* Aka: aim for next block. */ FEERATE_NORMAL, /* Aka: next 4 blocks or so. */ FEERATE_SLOW, /* Aka: next 100 blocks or so. */ }; diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index 409a1c8fc..e5b057d5d 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -21,7 +21,7 @@ static void update_feerates(struct lightningd *ld, struct channel *channel) { u8 *msg; - u32 feerate = try_get_feerate(ld->topology, FEERATE_IMMEDIATE); + u32 feerate = try_get_feerate(ld->topology, FEERATE_URGENT); /* Nothing to do if we don't know feerate. */ if (!feerate) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 327918c15..db962035c 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -230,7 +230,7 @@ u32 feerate_max(struct lightningd *ld, bool *unknown) return UINT_MAX; /* If we don't know feerate, don't limit other side. */ - feerate = try_get_feerate(ld->topology, FEERATE_IMMEDIATE); + feerate = try_get_feerate(ld->topology, FEERATE_URGENT); if (!feerate) { if (unknown) *unknown = true; diff --git a/tests/test_closing.py b/tests/test_closing.py index 5af1a914a..9eacc727d 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -894,7 +894,7 @@ def test_onchain_all_dust(node_factory, bitcoind, executor): # Make l1's fees really high (and wait for it to exceed 50000) l1.set_feerates((100000, 100000, 100000)) - l1.daemon.wait_for_log('Feerate estimate for Normal set to [56789][0-9]{4}') + l1.daemon.wait_for_log('Feerate estimate for normal set to [56789][0-9]{4}') bitcoind.generate_block(1) l1.daemon.wait_for_log(' to ONCHAIN') diff --git a/tests/test_connection.py b/tests/test_connection.py index fa69fedb2..b1e26694f 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1146,7 +1146,7 @@ def test_no_fee_estimate(node_factory, bitcoind, executor): # Restart estimatesmartfee, wait for it to pass 5000 l1.set_feerates((15000, 7500, 3750), True) - l1.daemon.wait_for_log('Feerate estimate for Normal set to [567][0-9]{3}') + l1.daemon.wait_for_log('Feerate estimate for normal set to [567][0-9]{3}') # Can now fund a channel. l1.rpc.connect(l2.info['id'], 'localhost', l2.port)