Crypto/Transaction/Signer/CompatP2WPKH.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 95.0% 38 / 40 CC 1 SCAR 1.1
CC
1
Cov
97%
_build_script
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Crypto/Transaction/Signer/Taproot.pm ↑ Summary Crypto/Util.pm »
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  
« Crypto/Transaction/Signer/Taproot.pm ↑ Summary Crypto/Util.pm »