| 1 | package Bitcoin::Crypto::Transaction::Signer::CompatP2WPKH; | ||
| 2 | 2 | $Bitcoin::Crypto::Transaction::Signer::CompatP2WPKH::VERSION = '4.005'; | |
| 3 | 2 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use Mooish::Base -standard; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | ▶ | use Bitcoin::Crypto::Script::Common; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use Bitcoin::Crypto::Exception; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 2 | ▶ | use Bitcoin::Crypto::Constants; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | use Bitcoin::Crypto::Types -types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 2 | extends 'Bitcoin::Crypto::Transaction::Signer::CompatSegwit'; | |
| 14 | |||
| 15 | 2 | has extended 'script' => ( | |
| 16 | writer => 1, | ||
| 17 | init_arg => undef, | ||
| 18 | lazy => 1, | ||
| 19 | ); | ||
| 20 | |||
| 21 | 2 | with 'Bitcoin::Crypto::Transaction::Signer::Role::KeyHash'; | |
| 22 | |||
| 23 | sub _build_script | ||
| 24 | 0 | ▶ | { |
|
Subroutine
_build_script: not called CC=1 SCAR=6.9
| |||
| 25 | 0 | Bitcoin::Crypto::Exception::Sign->raise( | |
| 26 | 'Compat P2WPKH script cannot be built - use add_signature with a proper private key' | ||
| 27 | ); | ||
| 28 | } | ||
| 29 | |||
| 30 | 2 | ▶ | before '_add_pkh' => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 31 | 2 | my ($self, $privkey) = @_; | |
| 32 | |||
| 33 | 2 | my $pubkey = $privkey->get_public_key; | |
| 34 | 2 | $self->set_script(Bitcoin::Crypto::Script::Common->new(PKH => $pubkey->get_hash)); | |
| 35 | 2 | $self->set_witness_program($pubkey->witness_program); | |
| 36 | 2 | }; | |
| 37 | |||
| 38 | 2 | 1; | |
| 39 | |||