MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_queryrates

Function test_queryrates

tests/test_opening.py:178–210  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

176@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
177@pytest.mark.openchannel('v2')
178def test_queryrates(node_factory, bitcoind):
179
180 opts = {'dev-no-reconnect': None}
181
182 l1, l2 = node_factory.get_nodes(2, opts=opts)
183
184 amount = 10 ** 6
185
186 l1.fundwallet(amount * 10)
187 l2.fundwallet(amount * 10)
188
189 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
190 with pytest.raises(RpcError, match=r'not advertising liquidity'):
191 l1.rpc.dev_queryrates(l2.info['id'], amount, amount * 10)
192
193 l2.rpc.call('funderupdate', {'policy': 'match',
194 'policy_mod': 100,
195 'per_channel_max_msat': '1btc',
196 'fuzz_percent': 0,
197 'lease_fee_base_msat': '2sat',
198 'funding_weight': 1000,
199 'lease_fee_basis': 140,
200 'channel_fee_max_base_msat': '3sat',
201 'channel_fee_max_proportional_thousandths': 101})
202
203 result = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
204 assert result['our_funding_msat'] == Millisatoshi(amount * 1000)
205 assert result['their_funding_msat'] == Millisatoshi(amount * 1000)
206 assert result['funding_weight'] == 1000
207 assert result['lease_fee_base_msat'] == Millisatoshi(2000)
208 assert result['lease_fee_basis'] == 140
209 assert result['channel_fee_max_base_msat'] == Millisatoshi(3000)
210 assert result['channel_fee_max_proportional_thousandths'] == 101
211
212
213@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')

Callers

nothing calls this directly

Calls 5

MillisatoshiClass · 0.90
get_nodesMethod · 0.80
fundwalletMethod · 0.80
connectMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected