@ -323,31 +323,33 @@ static void handle_irrevocably_resolved(struct channel *channel, const u8 *msg U
*/
static void onchain_add_utxo ( struct channel * channel , const u8 * msg )
{
struct utxo * u = tal ( msg , struct utxo ) ;
struct chain_coin_mvt * mvt ;
u32 blockheight ;
u - > close_info = tal ( u , struct unilateral_close_info ) ;
u - > is_p2sh = true ;
u - > keyindex = 0 ;
u - > status = output_state_available ;
u - > close_info - > channel_id = channel - > dbid ;
u - > close_info - > peer_id = channel - > peer - > id ;
u - > spendheight = NULL ;
u - > scriptPubkey = NULL ;
struct bitcoin_txid txid ;
u32 outnum ;
struct amount_sat amount ;
struct pubkey * commitment_point ;
u8 * scriptPubkey ;
if ( ! fromwire_onchain_add_utxo (
u , msg , & u - > txid , & u - > outnum , & u - > close_info - > commitment_point ,
& u - > amount , & blockheight , & u - > scriptPubkey ) ) {
fatal ( " onchaind gave invalid add_utxo message: %s " , tal_hex ( msg , msg ) ) ;
tmpctx , msg , & txid , & outnum , & commitment_point ,
& amount , & blockheight , & scriptPubkey ) ) {
log_broken ( channel - > log ,
" onchaind gave invalid add_utxo message: %s " ,
tal_hex ( msg , msg ) ) ;
return ;
}
u - > blockheight = blockheight > 0 ? & blockheight : NULL ;
outpointfilter_add ( channel - > peer - > ld - > wallet - > owned_outpoints , & u - > txid , u - > outnum ) ;
wallet_add_utxo ( channel - > peer - > ld - > wallet , u , p2wpkh ) ;
assert ( blockheight ) ;
outpointfilter_add ( channel - > peer - > ld - > wallet - > owned_outpoints ,
& txid , outnum ) ;
wallet_add_onchaind_utxo ( channel - > peer - > ld - > wallet ,
& txid , outnum , scriptPubkey ,
blockheight , amount , channel ,
commitment_point ) ;
mvt = new_coin_deposit_sat ( msg , " wallet " , & u - > txid ,
u - > outnum , blockheight , u - > amount ) ;
mvt = new_coin_deposit_sat ( msg , " wallet " , & txid ,
outnum , blockheight , amount ) ;
notify_chain_mvt ( channel - > peer - > ld , mvt ) ;
}