================================== FAILURES ===================================
_________________________ test_open_opener_with_inputs _________________________
[gw0] linux -- Python 3.6.15 /opt/hostedtoolcache/Python/3.6.15/x64/bin/python3
runner = <lnprototest.clightning.clightning.Runner object at 0x7feb2c8cd390>
with_proposal = <function with_proposal.<locals>._setter at 0x7feb2c4a40d0>
def test_open_opener_with_inputs(runner: Runner, with_proposal: Any) -> None:
with_proposal(dual_fund_csv)
runner.add_startup_flag('experimental-dual-fund')
local_funding_privkey = '20'
local_keyset = KeySet(revocation_base_secret='21',
payment_base_secret='22',
htlc_base_secret='24',
delayed_payment_base_secret='23',
shachain_seed='00' * 32)
# Index 5 is special, only the test runner can spend it
ii = 5
test = [Block(blockheight=102, txs=[tx_spendable]),
Connect(connprivkey='02'),
ExpectMsg('init'),
# BOLT-f53ca2301232db780843e894f55d95d512f297f9 #9:
# | 28/29 | `option_dual_fund` | Use v2 of channel open, enables dual funding | IN9 | `option_anchor_outputs`, `option_static_remotekey` | [BOLT #2](02-peer-protocol.md) |
Msg('init', globalfeatures='', features=bitfield(12, 20, 29)),
FundChannel(amount=999877),
ExpectMsg('open_channel2',
channel_id=channel_id_tmp(local_keyset, Side.remote),
chain_hash=regtest_hash,
funding_satoshis=999877,
dust_limit_satoshis=546,
htlc_minimum_msat=0,
to_self_delay=6,
funding_pubkey=remote_funding_pubkey(),
revocation_basepoint=remote_revocation_basepoint(),
payment_basepoint=remote_payment_basepoint(),
delayed_payment_basepoint=remote_delayed_payment_basepoint(),
htlc_basepoint=remote_htlc_basepoint(),
first_per_commitment_point=remote_per_commitment_point(0),
channel_flags='01'),
Msg('accept_channel2',
channel_id=rcvd('open_channel2.channel_id'),
dust_limit_satoshis=550,
funding_satoshis=400000,
max_htlc_value_in_flight_msat=4294967295,
htlc_minimum_msat=0,
minimum_depth=3,
max_accepted_htlcs=483,
# We use 5, to be different from c-lightning runner who uses 6
to_self_delay=5,
funding_pubkey=pubkey_of(local_funding_privkey),
revocation_basepoint=local_keyset.revocation_basepoint(),
payment_basepoint=local_keyset.payment_basepoint(),
delayed_payment_basepoint=local_keyset.delayed_payment_basepoint(),
htlc_basepoint=local_keyset.htlc_basepoint(),
first_per_commitment_point=local_keyset.per_commit_point(0)),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
# Create and stash Funding object and FundingTx
CreateDualFunding(fee=200,
funding_sats=agreed_funding(Side.remote),
locktime=rcvd('open_channel2.locktime', int),
local_node_privkey='02',
local_funding_privkey=local_funding_privkey,
remote_node_privkey=runner.get_node_privkey(),
remote_funding_privkey=remote_funding_privkey()),
ExpectMsg('tx_add_input',
channel_id=channel_id_v2(local_keyset),
if_match=even_serial,
prevtx=tx_spendable,
sequence=0xfffffffd,
script_sig=''),
AddInput(funding=funding(),
serial_id=rcvd('tx_add_input.serial_id', int),
prevtx=rcvd('tx_add_input.prevtx'),
prevtx_vout=rcvd('tx_add_input.prevtx_vout', int),
script_sig=rcvd('tx_add_input.script_sig')),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
Msg('tx_add_input',
channel_id=channel_id_v2(local_keyset),
serial_id=1,
sequence=0xfffffffd,
prevtx=tx_spendable,
prevtx_vout=tx_out_for_index(ii),
script_sig=''),
AddInput(funding=funding(),
privkey=privkey_for_index(ii),
serial_id=sent('tx_add_input.serial_id', int),
prevtx=sent(),
prevtx_vout=sent('tx_add_input.prevtx_vout', int),
script_sig=sent()),
# The funding output
ExpectMsg('tx_add_output',
channel_id=channel_id_v2(local_keyset),
sats=agreed_funding(Side.remote),
if_match=even_serial),
Msg('tx_add_output',
channel_id=channel_id_v2(local_keyset),
serial_id=101,
sats=change_amount(Side.remote, False,
'001473daa75958d5b2ddca87a6c279bb7cb307167037',
funding_amount_for_utxo(ii)),
script='001473daa75958d5b2ddca87a6c279bb7cb307167037'),
# FIXME: They may send us the funding output second,
# if there's also a change output
AddOutput(funding=funding(),
serial_id=rcvd('tx_add_output.serial_id', int),
sats=rcvd('tx_add_output.sats', int),
script=rcvd('tx_add_output.script')),
AddOutput(funding=funding(),
serial_id=sent('tx_add_output.serial_id', int),
script=sent(),
sats=sent('tx_add_output.sats', int)),
# Their change if they have one!
OneOf([ExpectMsg('tx_add_output',
if_match=even_serial,
channel_id=channel_id_v2(local_keyset)),
Msg('tx_complete',
channel_id=channel_id_v2(local_keyset)),
ExpectMsg('tx_complete',
channel_id=channel_id_v2(local_keyset)),
AddOutput(funding=funding(),
serial_id=rcvd('tx_add_output.serial_id', int),
sats=rcvd('tx_add_output.sats', int),
script=rcvd('tx_add_output.script'))],
[ExpectMsg('tx_complete',
channel_id=channel_id_v2(local_keyset)),
Msg('tx_complete',
channel_id=channel_id_v2(local_keyset)),
]),
FinalizeFunding(funding=funding()),
Commit(funding=funding(),
opener=Side.remote,
local_keyset=local_keyset,
local_to_self_delay=rcvd('open_channel2.to_self_delay', int),
remote_to_self_delay=sent('accept_channel2.to_self_delay', int),
local_amount=msat(sent('accept_channel2.funding_satoshis', int)),
remote_amount=msat(rcvd('open_channel2.funding_satoshis', int)),
local_dust_limit=550,
remote_dust_limit=546,
feerate=rcvd('open_channel2.commitment_feerate_perkw', int),
local_features=sent('init.features'),
remote_features=rcvd('init.features')),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
ExpectMsg('commitment_signed',
channel_id=channel_id_v2(local_keyset),
signature=commitsig_to_recv()),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
Msg('commitment_signed',
channel_id=channel_id_v2(local_keyset),
signature=commitsig_to_send(),
htlc_signature='[]'),
Msg('tx_signatures',
channel_id=channel_id_v2(local_keyset),
txid=funding_txid(),
witness_stack=witnesses()),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
ExpectMsg('tx_signatures',
channel_id=channel_id_v2(local_keyset),
txid=funding_txid()),
AddWitnesses(funding=funding(),
witness_stack=rcvd('witness_stack')),
# Mine the block!
Block(blockheight=103, number=3, txs=[funding_tx()]),
ExpectMsg('funding_locked',
channel_id=channel_id_v2(local_keyset),
next_per_commitment_point=remote_per_commitment_point(1)),
# Ignore unknown odd messages
TryAll([], RawMsg(bytes.fromhex('270F'))),
]
> runner.run(test)
tests/test_bolt2-20-open_channel_accepter.py:895:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lnprototest/runner.py:86: in run
self.stop()
lnprototest/clightning/clightning.py:133: in stop
cb()
lnprototest/clightning/clightning.py:123: in kill_fundchannel
fut.result(0)
/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/concurrent/futures/_base.py:425: in result
return self.__get_result()
/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/concurrent/futures/_base.py:384: in __get_result
raise self._exception
/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/concurrent/futures/_base.py:324: in _invoke_callbacks
callback(self)
lnprototest/clightning/clightning.py:223: in _done
raise(exception)
/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/concurrent/futures/thread.py:56: in run
result = self.fn(*self.args, **self.kwargs)
lnprototest/clightning/clightning.py:218: in _fundchannel
return runner.rpc.fundchannel(peer_id, amount, feerate='{}perkw'.format(feerate))
../../contrib/pyln-client/pyln/client/lightning.py:730: in fundchannel
return self.call("fundchannel", payload)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyln.client.lightning.LightningRpc object at 0x7feb2c5e5518>
method = 'fundchannel'
payload = {'amount': 999877, 'announce': True, 'feerate': '253perkw', 'id': '02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5'}
def call(self, method, payload=None):
self.logger.debug("Calling %s with payload %r", method, payload)
if payload is None:
payload = {}
# Filter out arguments that are None
if isinstance(payload, dict):
payload = {k: v for k, v in payload.items() if v is not None}
# FIXME: we open a new socket for every readobj call...
sock = UnixSocket(self.socket_path)
this_id = self.next_id
self.next_id += 0
buf = b''
if self._notify is not None:
# Opt into the notifications support
self._writeobj(sock, {
"jsonrpc": "2.0",
"method": "notifications",
"id": 0,
"params": {
"enable": True
},
})
# FIXME: Notification schema support?
_, buf = self._readobj(sock, buf)
request = {
"jsonrpc": "2.0",
"method": method,
"params": payload,
"id": this_id,
}
self._writeobj(sock, request)
while True:
resp, buf = self._readobj(sock, buf)
id = resp.get("id", None)
meth = resp.get("method", None)
if meth == 'message' and self._notify is not None:
n = resp['params']
self._notify(
message=n.get('message', None),
progress=n.get('progress', None),
request=request
)
continue
if meth is None or id is None:
break
self.logger.debug("Received response for %s call: %r", method, resp)
if 'id' in resp and resp['id'] != this_id:
raise ValueError("Malformed response, id is not {}: {}.".format(this_id, resp))
sock.close()
if not isinstance(resp, dict):
raise ValueError("Malformed response, response is not a dictionary %s." % resp)
elif "error" in resp:
> raise RpcError(method, payload, resp['error'])
E pyln.client.lightning.RpcError: RPC call failed: method: fundchannel, payload: {'id': '02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5', 'amount': 999877, 'feerate': '253perkw', 'announce': True}, error: {'code': 303, 'message': 'Error broadcasting funding tx: error code: -27\\\\nerror message:\\\\nTransaction already in block chain. Unsent tx discarded 020000000001022f144a38afb7c3886d18f5283a8da92e79c7f6a24a64a5c7f9d5187ac2753f360500000000fdffffff2f144a38afb7c3886d18f5283a8da92e79c7f6a24a64a5c7f9d5187ac2753f360400000000fdffffff036e8501000000000016001473daa75958d5b2ddca87a6c279bb7cb307167037a1c62d0000000000160014d640ab16f347d1de5aba5a715321a5fc4ba9a5d5455c150000000000220020c46bf3d1686d6dbb2d9244f8f67b90370c5aa2747045f1aeccb77d81871173820247304402200939a3f094dbf21f3d6b36dca578601f31e1b61e86d3783f4ebd64b4b1ebe78202206429702a2e7c57ef0f2868d17744ddcf63334e8f9aa90454b9f97855490be072012102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee50247304402205fb99a0b718e201deb264bff0f93ffb7a74e24c8589679b18dba6453a1d1662102200ce4f83ff4bbc7a010b4c1d5c57ea29b23ca4c8cef2aca1e23e6b30203dd8f3a0121026957e53b46df017bd6460681d068e1d23a7b027de398272d0b15f59b78d060a966000000.', 'data': {'id': '02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5', 'method': 'openchannel_signed'}}
../../contrib/pyln-client/pyln/client/lightning.py:387: RpcError