@@ -1825,7 +1825,7 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
1825
1825
!inflight -> tx_broadcast ) {
1826
1826
inflight -> tx_broadcast = true;
1827
1827
1828
- wtx = psbt_final_tx (NULL , inflight -> funding_psbt );
1828
+ wtx = psbt_final_tx (tmpctx , inflight -> funding_psbt );
1829
1829
if (!wtx ) {
1830
1830
channel_internal_error (channel ,
1831
1831
"Unable to extract final tx"
@@ -1835,29 +1835,6 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
1835
1835
return ;
1836
1836
}
1837
1837
1838
- /* Saves the now finalized version of the psbt */
1839
- wallet_inflight_save (dualopend -> ld -> wallet , inflight );
1840
- send_funding_tx (channel , take (wtx ));
1841
-
1842
- /* Must be in an "init" state */
1843
- assert (channel -> state == DUALOPEND_OPEN_COMMITTED
1844
- || channel -> state == DUALOPEND_AWAITING_LOCKIN );
1845
-
1846
- channel_set_state (channel , channel -> state ,
1847
- DUALOPEND_AWAITING_LOCKIN ,
1848
- REASON_UNKNOWN ,
1849
- "Sigs exchanged, waiting for lock-in" );
1850
-
1851
- /* Mimic the old behavior, notify a channel has been opened,
1852
- * for the accepter side */
1853
- if (channel -> opener == REMOTE )
1854
- /* Tell plugins about the success */
1855
- notify_channel_opened (dualopend -> ld ,
1856
- & channel -> peer -> id ,
1857
- & channel -> funding_sats ,
1858
- & channel -> funding .txid ,
1859
- channel -> remote_channel_ready );
1860
-
1861
1838
/* BOLT #2
1862
1839
* The receiving node: ...
1863
1840
* - MUST fail the channel if:
@@ -1879,7 +1856,31 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
1879
1856
/* Notify the peer we're failing */
1880
1857
subd_send_msg (dualopend ,
1881
1858
take (towire_dualopend_fail (NULL , errmsg )));
1859
+ return ;
1882
1860
}
1861
+
1862
+ /* Saves the now finalized version of the psbt */
1863
+ wallet_inflight_save (dualopend -> ld -> wallet , inflight );
1864
+ send_funding_tx (channel , take (wtx ));
1865
+
1866
+ /* Must be in an "init" state */
1867
+ assert (channel -> state == DUALOPEND_OPEN_COMMITTED
1868
+ || channel -> state == DUALOPEND_AWAITING_LOCKIN );
1869
+
1870
+ channel_set_state (channel , channel -> state ,
1871
+ DUALOPEND_AWAITING_LOCKIN ,
1872
+ REASON_UNKNOWN ,
1873
+ "Sigs exchanged, waiting for lock-in" );
1874
+
1875
+ /* Mimic the old behavior, notify a channel has been opened,
1876
+ * for the accepter side */
1877
+ if (channel -> opener == REMOTE )
1878
+ /* Tell plugins about the success */
1879
+ notify_channel_opened (dualopend -> ld ,
1880
+ & channel -> peer -> id ,
1881
+ & channel -> funding_sats ,
1882
+ & channel -> funding .txid ,
1883
+ channel -> remote_channel_ready );
1883
1884
}
1884
1885
}
1885
1886
@@ -2170,7 +2171,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
2170
2171
2171
2172
/* Saves the now finalized version of the psbt */
2172
2173
wallet_inflight_save (ld -> wallet , inflight );
2173
- wtx = psbt_final_tx (NULL , inflight -> funding_psbt );
2174
+ wtx = psbt_final_tx (tmpctx , inflight -> funding_psbt );
2174
2175
if (!wtx ) {
2175
2176
channel_internal_error (channel ,
2176
2177
"Unable to extract final tx"
@@ -2180,26 +2181,6 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
2180
2181
return ;
2181
2182
}
2182
2183
2183
- send_funding_tx (channel , take (wtx ));
2184
-
2185
- assert (channel -> state == DUALOPEND_OPEN_COMMITTED
2186
- /* We might be reconnecting */
2187
- || channel -> state == DUALOPEND_AWAITING_LOCKIN );
2188
- channel_set_state (channel , channel -> state ,
2189
- DUALOPEND_AWAITING_LOCKIN ,
2190
- REASON_UNKNOWN ,
2191
- "Sigs exchanged, waiting for lock-in" );
2192
-
2193
- /* Mimic the old behavior, notify a channel has been opened,
2194
- * for the accepter side */
2195
- if (channel -> opener == REMOTE )
2196
- /* Tell plugins about the success */
2197
- notify_channel_opened (dualopend -> ld ,
2198
- & channel -> peer -> id ,
2199
- & channel -> funding_sats ,
2200
- & channel -> funding .txid ,
2201
- channel -> remote_channel_ready );
2202
-
2203
2184
/* BOLT #2
2204
2185
* The receiving node: ...
2205
2186
* - MUST fail the channel if:
@@ -2221,7 +2202,28 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
2221
2202
/* Notify the peer we're failing */
2222
2203
subd_send_msg (dualopend ,
2223
2204
take (towire_dualopend_fail (NULL , errmsg )));
2205
+ return ;
2224
2206
}
2207
+ send_funding_tx (channel , take (wtx ));
2208
+
2209
+ assert (channel -> state == DUALOPEND_OPEN_COMMITTED
2210
+ /* We might be reconnecting */
2211
+ || channel -> state == DUALOPEND_AWAITING_LOCKIN );
2212
+ channel_set_state (channel , channel -> state ,
2213
+ DUALOPEND_AWAITING_LOCKIN ,
2214
+ REASON_UNKNOWN ,
2215
+ "Sigs exchanged, waiting for lock-in" );
2216
+
2217
+ /* Mimic the old behavior, notify a channel has been opened,
2218
+ * for the accepter side */
2219
+ if (channel -> opener == REMOTE )
2220
+ /* Tell plugins about the success */
2221
+ notify_channel_opened (dualopend -> ld ,
2222
+ & channel -> peer -> id ,
2223
+ & channel -> funding_sats ,
2224
+ & channel -> funding .txid ,
2225
+ channel -> remote_channel_ready );
2226
+
2225
2227
}
2226
2228
2227
2229
/* Send notification with peer's signed PSBT */
0 commit comments