mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-31 03:34:29 +01:00
bitcoin/script: define standard scriptpubkey lengths.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
31153e9506
commit
070929f92e
@@ -374,7 +374,7 @@ bool is_p2pkh(const u8 *script, struct bitcoin_address *addr)
|
||||
{
|
||||
size_t script_len = tal_len(script);
|
||||
|
||||
if (script_len != 25)
|
||||
if (script_len != BITCOIN_SCRIPTPUBKEY_P2PKH_LEN)
|
||||
return false;
|
||||
if (script[0] != OP_DUP)
|
||||
return false;
|
||||
@@ -395,7 +395,7 @@ bool is_p2sh(const u8 *script, struct ripemd160 *addr)
|
||||
{
|
||||
size_t script_len = tal_len(script);
|
||||
|
||||
if (script_len != 23)
|
||||
if (script_len != BITCOIN_SCRIPTPUBKEY_P2SH_LEN)
|
||||
return false;
|
||||
if (script[0] != OP_HASH160)
|
||||
return false;
|
||||
@@ -412,7 +412,7 @@ bool is_p2wsh(const u8 *script, struct sha256 *addr)
|
||||
{
|
||||
size_t script_len = tal_len(script);
|
||||
|
||||
if (script_len != 1 + 1 + sizeof(struct sha256))
|
||||
if (script_len != BITCOIN_SCRIPTPUBKEY_P2WSH_LEN)
|
||||
return false;
|
||||
if (script[0] != OP_0)
|
||||
return false;
|
||||
@@ -427,7 +427,7 @@ bool is_p2wpkh(const u8 *script, struct bitcoin_address *addr)
|
||||
{
|
||||
size_t script_len = tal_len(script);
|
||||
|
||||
if (script_len != 1 + 1 + sizeof(struct ripemd160))
|
||||
if (script_len != BITCOIN_SCRIPTPUBKEY_P2WPKH_LEN)
|
||||
return false;
|
||||
if (script[0] != OP_0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user