mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
closingd: handle custommessages
We fail on odd messages in otherwise.
--------------------------------------------------------- Captured stderr call ----------------------------------------------------------
lightning_closingd: common/read_peer_msg.c:170: handle_peer_gossip_or_error: Assertion `!is_unknown_msg_discardable(msg)' failed.
lightning_closingd: FATAL SIGNAL 6 (version v0.10.0-3-gd0c30a4)
0x563b8eabd9a2 send_backtrace
common/daemon.c:39
0x563b8eabda4c crashdump
common/daemon.c:52
0x7f496292020f ???
???:0
0x7f496292018b ???
???:0
0x7f49628ff858 ???
???:0
0x7f49628ff728 ???
???:0
0x7f4962910f35 ???
???:0
0x563b8eaca7e3 handle_peer_gossip_or_error
common/read_peer_msg.c:170
0x563b8eab79f2 closing_read_peer_msg
closingd/closingd.c:116
0x563b8eab838a receive_offer
closingd/closingd.c:362
0x563b8eab9299 main
closingd/closingd.c:752
0x7f49629010b2 ???
???:0
0x563b8eab75dd ???
???:0
0xffffffffffffffff ???
???:0
lightning_closingd: FATAL SIGNAL (version v0.10.0-3-gd0c30a4)
0x563b8eabd9a2 send_backtrace
common/daemon.c:39
0x563b8eacb384 status_failed
common/status.c:207
0x563b8eacb5f0 status_backtrace_exit
common/subdaemon.c:25
0x563b8eabda55 crashdump
common/daemon.c:55
0x7f496292020f ???
???:0
0x7f496292018b ???
???:0
0x7f49628ff858 ???
???:0
0x7f49628ff728 ???
???:0
0x7f4962910f35 ???
???:0
0x563b8eaca7e3 handle_peer_gossip_or_error
common/read_peer_msg.c:170
0x563b8eab79f2 closing_read_peer_msg
closingd/closingd.c:116
0x563b8eab838a receive_offer
closingd/closingd.c:362
0x563b8eab9299 main
closingd/closingd.c:752
0x7f49629010b2 ???
???:0
0x563b8eab75dd ???
???:0
0xffffffffffffffff ???
???:0
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/peer_wire.h>
|
#include <wire/peer_wire.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
@@ -113,6 +114,17 @@ static u8 *closing_read_peer_msg(const tal_t *ctx,
|
|||||||
handle_gossip_msg(pps, take(msg));
|
handle_gossip_msg(pps, take(msg));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#if DEVELOPER
|
||||||
|
/* Handle custommsgs */
|
||||||
|
enum peer_wire type = fromwire_peektype(msg);
|
||||||
|
if (type % 2 == 1 && !peer_wire_is_defined(type)) {
|
||||||
|
/* The message is not part of the messages we know
|
||||||
|
* how to handle. Assume is custommsg, forward it
|
||||||
|
* to master. */
|
||||||
|
wire_sync_write(REQ_FD, take(towire_custommsg_in(NULL, msg)));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (!handle_peer_gossip_or_error(pps, channel_id, false, msg))
|
if (!handle_peer_gossip_or_error(pps, channel_id, false, msg))
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <lightningd/options.h>
|
#include <lightningd/options.h>
|
||||||
#include <lightningd/peer_control.h>
|
#include <lightningd/peer_control.h>
|
||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
|
#include <wire/common_wiregen.h>
|
||||||
|
|
||||||
static struct amount_sat calc_tx_fee(struct amount_sat sat_in,
|
static struct amount_sat calc_tx_fee(struct amount_sat sat_in,
|
||||||
const struct bitcoin_tx *tx)
|
const struct bitcoin_tx *tx)
|
||||||
@@ -163,6 +164,19 @@ static unsigned closing_msg(struct subd *sd, const u8 *msg, const int *fds UNUSE
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ((enum common_wire)t) {
|
||||||
|
#if DEVELOPER
|
||||||
|
case WIRE_CUSTOMMSG_IN:
|
||||||
|
handle_custommsg_in(sd->ld, sd->node_id, msg);
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
case WIRE_CUSTOMMSG_IN:
|
||||||
|
#endif
|
||||||
|
/* We send these. */
|
||||||
|
case WIRE_CUSTOMMSG_OUT:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user