mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-08 23:54:20 +01:00
channel_fail_permanent: Use a channel-level error, not an all-channels error.
Fixes: #1229
This commit is contained in:
committed by
Christian Decker
parent
d49915cdd2
commit
234d67da34
@@ -1,6 +1,7 @@
|
||||
#include <bitcoin/script.h>
|
||||
#include <ccan/crypto/hkdf_sha256/hkdf_sha256.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/wire_error.h>
|
||||
#include <gossipd/gen_gossip_wire.h>
|
||||
#include <inttypes.h>
|
||||
#include <lightningd/channel.h>
|
||||
@@ -287,6 +288,7 @@ void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
|
||||
va_list ap;
|
||||
char *why;
|
||||
u8 *msg;
|
||||
struct channel_id cid;
|
||||
|
||||
va_start(ap, fmt);
|
||||
why = tal_vfmt(channel, fmt, ap);
|
||||
@@ -305,15 +307,10 @@ void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
|
||||
|
||||
/* We can have multiple errors, eg. onchaind failures. */
|
||||
if (!channel->error) {
|
||||
/* BOLT #1:
|
||||
*
|
||||
* The channel is referred to by `channel_id` unless `channel_id` is
|
||||
* zero (ie. all bytes zero), in which case it refers to all
|
||||
* channels. */
|
||||
static const struct channel_id all_channels;
|
||||
u8 *msg = tal_dup_arr(NULL, u8, (const u8 *)why, strlen(why), 0);
|
||||
channel->error = towire_error(channel, &all_channels, msg);
|
||||
tal_free(msg);
|
||||
derive_channel_id(&cid,
|
||||
&channel->funding_txid,
|
||||
channel->funding_outnum);
|
||||
channel->error = towire_errorfmt(channel, &cid, "%s", why);
|
||||
}
|
||||
|
||||
channel_set_owner(channel, NULL);
|
||||
|
||||
@@ -1246,8 +1246,9 @@ class LightningDTests(BaseLightningDTests):
|
||||
l2.daemon.wait_for_log(' to ONCHAIN')
|
||||
l2.daemon.wait_for_log('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET (.*) after 5 blocks')
|
||||
|
||||
cid = l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'][0]['channel_id']
|
||||
wait_for(lambda: l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'][0]['status'] ==
|
||||
['CHANNELD_NORMAL:Received error from peer: channel ALL: Internal error: Failing due to dev-fail command',
|
||||
['CHANNELD_NORMAL:Received error from peer: channel {}: Internal error: Failing due to dev-fail command'.format(cid),
|
||||
'ONCHAIN:Tracking their unilateral close',
|
||||
'ONCHAIN:All outputs resolved: waiting 99 more blocks before forgetting channel'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user