pytest: test parsefeerate explicitly.

Since we're messing with feerates, it's good to test this directly upfront.

Also, fix documentation!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-04-07 14:09:53 +09:30
parent a2ca34ccf5
commit 7aa8c76002
3 changed files with 36 additions and 3 deletions

View file

@ -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: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:a34af89895413ee57defa1df715d9e50d34a49196972a81b31a4666b4fc05a10)
[comment]: # ( SHA256STAMP:773e4e66cb3654b7c3aafe54c33d433c52ff89f7a5a8be0a71a93da21a6b7eaa)

View file

@ -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",

View file

@ -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):
"""