script: enhance is_p2sh/is_p2pkh/is_p2wsh/is_p2wpkh to extract addr.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-10-26 13:28:19 +10:30
parent 58604a0497
commit 9ec5cb7ba2
5 changed files with 25 additions and 17 deletions

View File

@@ -1620,8 +1620,8 @@ static void peer_got_shutdown(struct peer *peer, const u8 *msg)
*
* A receiving node SHOULD fail the connection if the `scriptpubkey`
* is not one of those forms. */
if (!is_p2pkh(scriptpubkey) && !is_p2sh(scriptpubkey)
&& !is_p2wpkh(scriptpubkey) && !is_p2wsh(scriptpubkey)) {
if (!is_p2pkh(scriptpubkey, NULL) && !is_p2sh(scriptpubkey, NULL)
&& !is_p2wpkh(scriptpubkey, NULL) && !is_p2wsh(scriptpubkey, NULL)) {
char *str = tal_fmt(peer, "Bad shutdown scriptpubkey %s",
tal_hex(peer, scriptpubkey));
peer_fail_permanent_str(peer, take(str));