@@ -91,20 +91,21 @@ static void destroy_channel(struct channel *channel)
91
91
void delete_channel (struct channel * channel STEALS , bool completely_eliminate )
92
92
{
93
93
const u8 * msg ;
94
-
95
94
struct peer * peer = channel -> peer ;
95
+ struct lightningd * ld = peer -> ld ;
96
+
96
97
if (channel -> dbid != 0 ) {
97
- wallet_channel_close (channel -> peer -> ld -> wallet , channel -> dbid );
98
+ wallet_channel_close (ld -> wallet , channel -> dbid );
98
99
/* Never open at all, not ours. */
99
100
if (completely_eliminate )
100
- wallet_channel_delete (channel -> peer -> ld -> wallet , channel );
101
+ wallet_channel_delete (ld -> wallet , channel );
101
102
}
102
103
103
104
/* Tell the hsm to forget the channel, needs to be after it's
104
105
* been forgotten here */
105
- if (hsm_capable (channel -> peer -> ld , WIRE_HSMD_FORGET_CHANNEL )) {
106
- msg = towire_hsmd_forget_channel (NULL , & channel -> peer -> id , channel -> dbid );
107
- msg = hsm_sync_req (tmpctx , channel -> peer -> ld , take (msg ));
106
+ if (hsm_capable (ld , WIRE_HSMD_FORGET_CHANNEL )) {
107
+ msg = towire_hsmd_forget_channel (NULL , & peer -> id , channel -> dbid );
108
+ msg = hsm_sync_req (tmpctx , ld , take (msg ));
108
109
if (!fromwire_hsmd_forget_channel_reply (msg ))
109
110
fatal ("HSM gave bad hsm_forget_channel_reply %s" , tal_hex (msg , msg ));
110
111
}
0 commit comments