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 3 $Bitcoin::Crypto::Transaction::Signer::CompatP2WPKH::VERSION = '4.006';
3 3 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Bitcoin::Crypto::Script::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Bitcoin::Crypto::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Bitcoin::Crypto::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Bitcoin::Crypto::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 extends 'Bitcoin::Crypto::Transaction::Signer::CompatSegwit';
14  
15 3 has extended 'script' => (
16 writer => 1,
17 init_arg => undef,
18 lazy => 1,
19 );
20  
21 3 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 3 ▶before '_add_pkh' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
31 3 my ($self, $privkey) = @_;
32  
33 3 my $pubkey = $privkey->get_public_key;
34 3 $self->set_script(Bitcoin::Crypto::Script::Common->new(PKH => $pubkey->get_hash));
35 3 $self->set_witness_program($pubkey->witness_program);
36 3 };
37  
38 3 1;
39  
« Crypto/Transaction/Signer/Taproot.pm ↑ Summary Crypto/Util.pm »