mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
pytest: Fix the benchmark script
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
d9eba0e924
commit
c4ca2ab4b9
@@ -23,14 +23,11 @@ def executor():
|
|||||||
def bitcoind():
|
def bitcoind():
|
||||||
bitcoind = utils.BitcoinD(rpcport=28332)
|
bitcoind = utils.BitcoinD(rpcport=28332)
|
||||||
bitcoind.start()
|
bitcoind.start()
|
||||||
info = bitcoind.rpc.getinfo()
|
info = bitcoind.rpc.getblockchaininfo()
|
||||||
# Make sure we have segwit and some funds
|
# Make sure we have segwit and some funds
|
||||||
if info['blocks'] < 432:
|
if info['blocks'] < 432:
|
||||||
logging.debug("SegWit not active, generating some more blocks")
|
logging.debug("SegWit not active, generating some more blocks")
|
||||||
bitcoind.generate_block(432 - info['blocks'])
|
bitcoind.generate_block(432 - info['blocks'])
|
||||||
elif info['balance'] < 1:
|
|
||||||
logging.debug("Insufficient balance, generating 1 block")
|
|
||||||
bitcoind.generate_block(1)
|
|
||||||
|
|
||||||
yield bitcoind
|
yield bitcoind
|
||||||
|
|
||||||
@@ -43,16 +40,16 @@ def bitcoind():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def node_factory(request, bitcoind, executor):
|
def node_factory(request, bitcoind, executor):
|
||||||
nf = NodeFactory(request.node.name, bitcoind, executor)
|
nf = NodeFactory(request.node.name, bitcoind, executor, directory="/dev/shm/lightning-tests")
|
||||||
yield nf
|
yield nf
|
||||||
nf.killall()
|
nf.killall([False]*len(nf.nodes))
|
||||||
|
|
||||||
|
|
||||||
def test_single_hop(node_factory, executor):
|
def test_single_hop(node_factory, executor):
|
||||||
l1 = node_factory.get_node()
|
l1 = node_factory.get_node()
|
||||||
l2 = node_factory.get_node()
|
l2 = node_factory.get_node()
|
||||||
|
|
||||||
l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.rpc.getinfo()['port'])
|
l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port)
|
||||||
l1.openchannel(l2, 4000000)
|
l1.openchannel(l2, 4000000)
|
||||||
|
|
||||||
print("Collecting invoices")
|
print("Collecting invoices")
|
||||||
|
|||||||
Reference in New Issue
Block a user