Skip to content

Commit

Permalink
Adjust NULLDATA address format and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed Oct 12, 2023
1 parent 246a548 commit cf542cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Bitcoin/Crypto/Script.pm
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ sub get_address
return encode_base58check($self->network->p2sh_byte . $address);
}
elsif ($self->type eq 'NULLDATA') {
return "<$address>";
return qq("$address");
}
}

Expand Down
11 changes: 9 additions & 2 deletions t/11-script-standard-types.t
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,22 @@ my @cases = (

[
'NULLDATA',
[hex => '6a0b68656c6c6f20776f726c64']
[hex => '6a0b68656c6c6f20776f726c64'],
'"' . pack('H*', '68656c6c6f20776f726c64') . '"',
],

[
'NULLDATA',
[
hex =>
'6a4c504d454d4f5f35363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f313233343536373839'
]
],
'"'
. pack(
'H*',
'4d454d4f5f35363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f3132333435363738395f313233343536373839'
)
. '"',
],

# P2PKH, but OP_CHECKSIG is duplicated
Expand Down

0 comments on commit cf542cd

Please sign in to comment.