Skip to content

Commit d8bf0a8

Browse files
committed
Merge rust-bitcoin#5379: feat: Address::p2a
8142980 feat: Address::p2a (Christian Lewe) Pull request description: There is a method to check if an address is P2A, but there is no method to create a P2A address. This PR adds the P2A constructor. ACKs for top commit: apoelstra: ACK 8142980; successfully ran local tests tcharding: ACK 8142980 Tree-SHA512: 6e43647de5df5a6d0b27ca50319633c5fc97563c6e787cf307fc9c42c836f80ab614b60c8b927b4a52abe81ca9f254faaef04249fb1e34067ada5b5a29d626c8
2 parents 054d758 + 8142980 commit d8bf0a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bitcoin/src/address/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,11 @@ impl Address {
590590
Self::from_witness_program(program, hrp)
591591
}
592592

593+
/// Constructs a new pay-to-anchor (P2A) [`Address`].
594+
pub fn p2a(hrp: impl Into<KnownHrp>) -> Self {
595+
Self::from_witness_program(WitnessProgram::p2a(), hrp)
596+
}
597+
593598
/// Constructs a new [`Address`] from an arbitrary [`WitnessProgram`].
594599
///
595600
/// This only exists to support future witness versions. If you are doing normal mainnet things

0 commit comments

Comments
 (0)