common: remove peer_failed in favor of peer_failed_warn/peer_failed_err

And make all the callers choose which one.  In general, I prefer warn,
which lets them reconnect and try again, however some places are either
stated that they must be errors in the spec itself, or in openingd
where we abandon the channel when we close the connection anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Protocol: we now send warning messages and close the connection, except on unrecoverable errors.
This commit is contained in:
Rusty Russell
2021-02-02 23:19:01 +10:30
parent e6cefc4b00
commit f4ee41a989
9 changed files with 581 additions and 573 deletions

View File

@@ -1352,13 +1352,14 @@ def test_reserve_enforcement(node_factory, executor):
l2.start()
wait_for(lambda: only_one(l2.rpc.listpeers(l1.info['id'])['peers'])['connected'])
# This should be impossible to pay entire thing back: l1 should
# kill us for trying to violate reserve.
# This should be impossible to pay entire thing back: l1 should warn and
# close connection for trying to violate reserve.
executor.submit(l2.pay, l1, 1000000)
l1.daemon.wait_for_log(
'Peer permanent failure in CHANNELD_NORMAL: channeld: sent '
'ERROR Bad peer_add_htlc: CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED'
'Peer transient failure in CHANNELD_NORMAL: channeld.*'
' CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED'
)
assert only_one(l1.rpc.listpeers()['peers'])['connected'] is False
@unittest.skipIf(not DEVELOPER, "needs dev_disconnect")