@@ -786,17 +786,17 @@ impl Builder {
786786 self . 0 . push ( opcodes:: Ordinary :: OP_PUSHDATA1 . into_u8 ( ) ) ;
787787 self . 0 . push ( n as u8 ) ;
788788 } ,
789- n if n < 0x10000 => {
789+ n if n < 0x1_0000 => {
790790 self . 0 . push ( opcodes:: Ordinary :: OP_PUSHDATA2 . into_u8 ( ) ) ;
791791 self . 0 . push ( ( n % 0x100 ) as u8 ) ;
792792 self . 0 . push ( ( n / 0x100 ) as u8 ) ;
793793 } ,
794- n if n < 0x100000000 => {
794+ n if n < 0x1_0000_0000 => {
795795 self . 0 . push ( opcodes:: Ordinary :: OP_PUSHDATA4 . into_u8 ( ) ) ;
796796 self . 0 . push ( ( n % 0x100 ) as u8 ) ;
797797 self . 0 . push ( ( ( n / 0x100 ) % 0x100 ) as u8 ) ;
798- self . 0 . push ( ( ( n / 0x10000 ) % 0x100 ) as u8 ) ;
799- self . 0 . push ( ( n / 0x1000000 ) as u8 ) ;
798+ self . 0 . push ( ( ( n / 0x1_0000 ) % 0x100 ) as u8 ) ;
799+ self . 0 . push ( ( n / 0x100_0000 ) as u8 ) ;
800800 }
801801 _ => panic ! ( "tried to put a 4bn+ sized object into a script!" )
802802 }
@@ -977,10 +977,10 @@ mod test {
977977 script = script. push_scriptint ( 4 ) ; comp. extend ( [ 1u8 , 4 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
978978 // big ints
979979 script = script. push_int ( 17 ) ; comp. extend ( [ 1u8 , 17 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
980- script = script. push_int ( 10000 ) ; comp. extend ( [ 2u8 , 16 , 39 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
980+ script = script. push_int ( 10_000 ) ; comp. extend ( [ 2u8 , 16 , 39 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
981981 // notice the sign bit set here, hence the extra zero/128 at the end
982- script = script. push_int ( 10000000 ) ; comp. extend ( [ 4u8 , 128 , 150 , 152 , 0 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
983- script = script. push_int ( -10000000 ) ; comp. extend ( [ 4u8 , 128 , 150 , 152 , 128 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
982+ script = script. push_int ( 10_000_000 ) ; comp. extend ( [ 4u8 , 128 , 150 , 152 , 0 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
983+ script = script. push_int ( -10_000_000 ) ; comp. extend ( [ 4u8 , 128 , 150 , 152 , 128 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
984984
985985 // data
986986 script = script. push_slice ( b"NRA4VR" ) ; comp. extend ( [ 6u8 , 78 , 82 , 65 , 52 , 86 , 82 ] . iter ( ) . copied ( ) ) ; assert_eq ! ( & script[ ..] , & comp[ ..] ) ;
@@ -1097,7 +1097,7 @@ mod test {
10971097 assert_eq ! ( build_scriptint( 256 ) , vec![ 0 , 1 ] ) ;
10981098 assert_eq ! ( build_scriptint( 257 ) , vec![ 1 , 1 ] ) ;
10991099 assert_eq ! ( build_scriptint( 511 ) , vec![ 255 , 1 ] ) ;
1100- for & i in & [ 10 , 100 , 255 , 256 , 1000 , 10000 , 25000 , 200000 , 5000000 , 1000000000 ,
1100+ for & i in & [ 10 , 100 , 255 , 256 , 1000 , 10000 , 25000 , 200_000 , 5_000_000 , 1_000_000_000 ,
11011101 ( 1 << 31 ) - 1 , -( ( 1 << 31 ) - 1 ) ] {
11021102 assert_eq ! ( Ok ( i) , read_scriptint( & build_scriptint( i) ) ) ;
11031103 assert_eq ! ( Ok ( -i) , read_scriptint( & build_scriptint( -i) ) ) ;
0 commit comments