diff --git a/doc/lightning-feerates.7.md b/doc/lightning-feerates.7.md index db4139d92..e047e72fe 100644 --- a/doc/lightning-feerates.7.md +++ b/doc/lightning-feerates.7.md @@ -48,7 +48,7 @@ RETURN VALUE On success, an object is returned, containing: - **perkb** (object, optional): If *style* parameter was perkb: - - **min\_acceptable** (u32): The smallest feerate that you can use, usually the minimum relayed feerate of the backend + - **min\_acceptable** (u32): The smallest feerate that we allow peers to specify: half the 100-block estimate - **max\_acceptable** (u32): The largest feerate we will accept from remote negotiations. If a peer attempts to set the feerate higher than this we will unilaterally close the channel (or simply forget it if it's not open yet). - **opening** (u32, optional): Default feerate for lightning-fundchannel(7) and lightning-withdraw(7) - **mutual\_close** (u32, optional): Feerate to aim for in cooperative shutdown. Note that since mutual close is a **negotiation**, the actual feerate used in mutual close will be somewhere between this and the corresponding mutual close feerate of the peer. @@ -121,4 +121,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:a34af89895413ee57defa1df715d9e50d34a49196972a81b31a4666b4fc05a10) +[comment]: # ( SHA256STAMP:773e4e66cb3654b7c3aafe54c33d433c52ff89f7a5a8be0a71a93da21a6b7eaa) diff --git a/doc/schemas/feerates.schema.json b/doc/schemas/feerates.schema.json index 980f1d20c..d7019f17d 100644 --- a/doc/schemas/feerates.schema.json +++ b/doc/schemas/feerates.schema.json @@ -19,7 +19,7 @@ "properties": { "min_acceptable": { "type": "u32", - "description": "The smallest feerate that you can use, usually the minimum relayed feerate of the backend" + "description": "The smallest feerate that we allow peers to specify: half the 100-block estimate" }, "max_acceptable": { "type": "u32", diff --git a/tests/test_misc.py b/tests/test_misc.py index 50bb48333..5dbe90dc8 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -3214,6 +3214,39 @@ def test_hsm_capabilities(node_factory): assert l1.daemon.is_in_log(r"hsmd: capability \+WIRE_HSMD_CHECK_PUBKEY") +def test_feerate_arg(node_factory): + """Make sure our variants of feerate argument work!""" + l1 = node_factory.get_node() + + # These are the get_node() defaults + by_blocks = {2: 15000, + 6: 11000, + 12: 7500, + 100: 3750} + + # Literal values: + fees = {"9999perkw": 9999, + "10000perkb": 10000 // 4, + 10000: 10000 // 4} + + fees["urgent"] = by_blocks[6] + fees["normal"] = by_blocks[12] + fees["slow"] = by_blocks[100] // 2 + + fees["opening"] = by_blocks[12] + fees["mutual_close"] = by_blocks[100] + fees["penalty"] = by_blocks[12] + fees["unilateral_close"] = by_blocks[6] + fees["delayed_to_us"] = by_blocks[12] + fees["htlc_resolution"] = by_blocks[6] + fees["min_acceptable"] = by_blocks[100] // 2 + fees["max_acceptable"] = by_blocks[2] * 10 + + for fee, expect in fees.items(): + # Put arg in assertion, so it gets printed on failure! + assert (l1.rpc.parsefeerate(fee), fee) == ({'perkw': expect}, fee) + + @pytest.mark.skip(reason="Fails by intention for creating test gossip stores") def test_create_gossip_mesh(node_factory, bitcoind): """