File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1431,8 +1431,12 @@ mod tests {
1431
1431
#[ test]
1432
1432
fn expr_features ( ) {
1433
1433
// test that parsing raw hash160 does not work with
1434
- let hash160_str = "e9f171df53e04b270fa6271b42f66b0f4a99c5a2" ;
1435
- let ms_str = & format ! ( "c:expr_raw_pkh({})" , hash160_str) ;
1434
+ let pk = bitcoin:: PublicKey :: from_str (
1435
+ "02c2fd50ceae468857bb7eb32ae9cd4083e6c7e42fbbec179d81134b3e3830586c" ,
1436
+ )
1437
+ . unwrap ( ) ;
1438
+ let hash160 = pk. pubkey_hash ( ) . to_raw_hash ( ) ;
1439
+ let ms_str = & format ! ( "c:expr_raw_pkh({})" , hash160) ;
1436
1440
type SegwitMs = Miniscript < bitcoin:: PublicKey , Segwitv0 > ;
1437
1441
1438
1442
// Test that parsing raw hash160 from string does not work without extra features
@@ -1445,6 +1449,12 @@ mod tests {
1445
1449
SegwitMs :: parse ( & script) . unwrap_err ( ) ;
1446
1450
SegwitMs :: parse_insane ( & script) . unwrap_err ( ) ;
1447
1451
SegwitMs :: parse_with_ext ( & script, & ExtParams :: allow_all ( ) ) . unwrap ( ) ;
1452
+
1453
+ // Try replacing the raw_pkh with a pkh
1454
+ let mut map = BTreeMap :: new ( ) ;
1455
+ map. insert ( hash160, pk) ;
1456
+ let ms_no_raw = ms. substitute_raw_pkh ( & map) ;
1457
+ assert_eq ! ( ms_no_raw. to_string( ) , format!( "pkh({})" , pk) , ) ;
1448
1458
}
1449
1459
1450
1460
#[ test]
You can’t perform that action at this time.
0 commit comments