@ -40,23 +40,21 @@ void wallet_add_signed_input(struct lightningd_state *dstate,
struct bitcoin_signature sig ;
struct bitcoin_signature sig ;
assert ( input_num < tx - > input_count ) ;
assert ( input_num < tx - > input_count ) ;
redeemscript = bitcoin_redeem_single ( tx , & w - > pubkey ) ;
redeemscript = bitcoin_redeem_p2wpkh ( tx , & w - > pubkey ) ;
sig . stype = SIGHASH_ALL ;
sig . stype = SIGHASH_ALL ;
sign_tx_input ( dstate - > secpctx , tx , input_num ,
sign_tx_input ( dstate - > secpctx , tx , input_num ,
redeemscript , tal_count ( redeemscript ) ,
redeemscript , tal_count ( redeemscript ) ,
NULL ,
p2wpkh_scriptcode ( redeemscript , & w - > pubkey ) ,
& w - > privkey ,
& w - > privkey ,
& w - > pubkey ,
& w - > pubkey ,
& sig . sig ) ;
& sig . sig ) ;
tx - > input [ input_num ] . script
bitcoin_witness_p2sh_p2wpkh ( tx - > input ,
= scriptsig_p2sh_single_sig ( tx - > input ,
& tx - > input [ input_num ] ,
redeemscript ,
& sig ,
tal_count ( redeemscript ) ,
& w - > pubkey ) ;
& sig ) ;
tal_free ( redeemscript ) ;
tx - > input [ input_num ] . script_length
= tal_count ( tx - > input [ input_num ] . script ) ;
}
}
struct wallet * wallet_can_spend ( struct lightningd_state * dstate ,
struct wallet * wallet_can_spend ( struct lightningd_state * dstate ,
@ -85,7 +83,7 @@ static void json_newaddr(struct command *cmd,
struct sha256 h ;
struct sha256 h ;
new_keypair ( cmd - > dstate , & w - > privkey , & w - > pubkey ) ;
new_keypair ( cmd - > dstate , & w - > privkey , & w - > pubkey ) ;
redeemscript = bitcoin_redeem_single ( cmd , & w - > pubkey ) ;
redeemscript = bitcoin_redeem_p2wpkh ( cmd , & w - > pubkey ) ;
sha256 ( & h , redeemscript , tal_count ( redeemscript ) ) ;
sha256 ( & h , redeemscript , tal_count ( redeemscript ) ) ;
ripemd160 ( & w - > p2sh , h . u . u8 , sizeof ( h ) ) ;
ripemd160 ( & w - > p2sh , h . u . u8 , sizeof ( h ) ) ;