mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +01:00
htlc_wire: rename malformed to failcode in struct failed_htlc.
I'm not completely convinced that it's only ever set to a failcode with the BADONION bit set, especially after the previous patches in this series. Now that channeld can handle arbitrary failcodes passed this way, simply rename it. We add marshalling assertions that only one of failcode and failreason is set, and we unmarshal an empty 'fail' to NULL (just the the generated unmarshalling code does). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
5a184c24e8
commit
68a8eeea21
@@ -771,8 +771,8 @@ static bool peer_failed_our_htlc(struct channel *channel,
|
||||
if (!htlc_out_update_state(channel, hout, RCVD_REMOVE_COMMIT))
|
||||
return false;
|
||||
|
||||
hout->failcode = failed->malformed;
|
||||
if (!failed->malformed)
|
||||
hout->failcode = failed->failcode;
|
||||
if (!failed->failcode)
|
||||
hout->failuremsg = tal_dup_arr(hout, u8, failed->failreason,
|
||||
tal_len(failed->failreason), 0);
|
||||
|
||||
@@ -1384,7 +1384,7 @@ static void add_fulfill(u64 id, enum side side,
|
||||
}
|
||||
|
||||
static void add_fail(u64 id, enum side side,
|
||||
enum onion_type malformed,
|
||||
enum onion_type failcode,
|
||||
const u8 *failuremsg,
|
||||
const struct failed_htlc ***failed_htlcs,
|
||||
enum side **failed_sides)
|
||||
@@ -1397,7 +1397,7 @@ static void add_fail(u64 id, enum side side,
|
||||
|
||||
*f = tal(*failed_htlcs, struct failed_htlc);
|
||||
(*f)->id = id;
|
||||
(*f)->malformed = malformed;
|
||||
(*f)->failcode = failcode;
|
||||
if (failuremsg)
|
||||
(*f)->failreason
|
||||
= tal_dup_arr(*f, u8, failuremsg, tal_len(failuremsg), 0);
|
||||
|
||||
Reference in New Issue
Block a user