2323//! This module provides the structures and functions needed to support scripts.
2424//!
2525
26- use prelude:: * ;
26+ use crate :: prelude:: * ;
2727
28- use io;
28+ use crate :: io;
2929use core:: { fmt, default:: Default } ;
3030use core:: ops:: Index ;
3131
3232#[ cfg( feature = "serde" ) ] use serde;
3333
34- use hash_types:: { PubkeyHash , WPubkeyHash , ScriptHash , WScriptHash } ;
35- use blockdata:: opcodes;
36- use consensus:: { encode, Decodable , Encodable } ;
37- use hashes:: { Hash , hex} ;
38- use policy:: DUST_RELAY_TX_FEE ;
34+ use crate :: hash_types:: { PubkeyHash , WPubkeyHash , ScriptHash , WScriptHash } ;
35+ use crate :: blockdata:: opcodes;
36+ use crate :: consensus:: { encode, Decodable , Encodable } ;
37+ use crate :: hashes:: { Hash , hex} ;
38+ use crate :: policy:: DUST_RELAY_TX_FEE ;
3939#[ cfg( feature="bitcoinconsensus" ) ] use bitcoinconsensus;
4040#[ cfg( feature="bitcoinconsensus" ) ] use core:: convert:: From ;
41- use OutPoint ;
41+ use crate :: OutPoint ;
4242
43- use util:: key:: PublicKey ;
44- use util:: address:: WitnessVersion ;
45- use util:: taproot:: { LeafVersion , TapBranchHash , TapLeafHash } ;
43+ use crate :: util:: key:: PublicKey ;
44+ use crate :: util:: address:: WitnessVersion ;
45+ use crate :: util:: taproot:: { LeafVersion , TapBranchHash , TapLeafHash } ;
4646use secp256k1:: { Secp256k1 , Verification , XOnlyPublicKey } ;
47- use schnorr:: { TapTweak , TweakedPublicKey , UntweakedPublicKey } ;
47+ use crate :: schnorr:: { TapTweak , TweakedPublicKey , UntweakedPublicKey } ;
4848
4949/// A Bitcoin script.
5050#[ derive( Clone , Default , PartialOrd , Ord , PartialEq , Eq , Hash ) ]
@@ -557,7 +557,7 @@ impl Script {
557557
558558 /// Checks whether a script can be proven to have no satisfying input.
559559 pub fn is_provably_unspendable ( & self ) -> bool {
560- use blockdata:: opcodes:: Class :: { ReturnOp , IllegalOp } ;
560+ use crate :: blockdata:: opcodes:: Class :: { ReturnOp , IllegalOp } ;
561561
562562 match self . 0 . first ( ) {
563563 Some ( b) => {
@@ -572,7 +572,7 @@ impl Script {
572572
573573 /// Returns the minimum value an output with this script should have in order to be
574574 /// broadcastable on today's Bitcoin network.
575- pub fn dust_value ( & self ) -> :: Amount {
575+ pub fn dust_value ( & self ) -> crate :: Amount {
576576 // This must never be lower than Bitcoin Core's GetDustThreshold() (as of v0.21) as it may
577577 // otherwise allow users to create transactions which likely can never be broadcast/confirmed.
578578 let sats = DUST_RELAY_TX_FEE as u64 / 1000 * // The default dust relay fee is 3000 satoshi/kB (i.e. 3 sat/vByte)
@@ -588,7 +588,7 @@ impl Script {
588588 self . consensus_encode ( & mut sink ( ) ) . expect ( "sinks don't error" ) as u64 // The serialized size of this script_pubkey
589589 } ;
590590
591- :: Amount :: from_sat ( sats)
591+ crate :: Amount :: from_sat ( sats)
592592 }
593593
594594 /// Iterates over the script in the form of `Instruction`s, which are an enum covering opcodes,
@@ -1075,11 +1075,11 @@ mod test {
10751075 use super :: * ;
10761076 use super :: build_scriptint;
10771077
1078- use hashes:: hex:: { FromHex , ToHex } ;
1079- use consensus:: encode:: { deserialize, serialize} ;
1080- use blockdata:: opcodes;
1081- use util:: key:: PublicKey ;
1082- use util:: psbt:: serialize:: Serialize ;
1078+ use crate :: hashes:: hex:: { FromHex , ToHex } ;
1079+ use crate :: consensus:: encode:: { deserialize, serialize} ;
1080+ use crate :: blockdata:: opcodes;
1081+ use crate :: util:: key:: PublicKey ;
1082+ use crate :: util:: psbt:: serialize:: Serialize ;
10831083
10841084 #[ test]
10851085 fn script ( ) {
@@ -1449,7 +1449,7 @@ mod test {
14491449 // well-known scriptPubKey types.
14501450 let script_p2wpkh = Builder :: new ( ) . push_int ( 0 ) . push_slice ( & [ 42 ; 20 ] ) . into_script ( ) ;
14511451 assert ! ( script_p2wpkh. is_v0_p2wpkh( ) ) ;
1452- assert_eq ! ( script_p2wpkh. dust_value( ) , :: Amount :: from_sat( 294 ) ) ;
1452+ assert_eq ! ( script_p2wpkh. dust_value( ) , crate :: Amount :: from_sat( 294 ) ) ;
14531453
14541454 let script_p2pkh = Builder :: new ( )
14551455 . push_opcode ( opcodes:: all:: OP_DUP )
@@ -1459,7 +1459,7 @@ mod test {
14591459 . push_opcode ( opcodes:: all:: OP_CHECKSIG )
14601460 . into_script ( ) ;
14611461 assert ! ( script_p2pkh. is_p2pkh( ) ) ;
1462- assert_eq ! ( script_p2pkh. dust_value( ) , :: Amount :: from_sat( 546 ) ) ;
1462+ assert_eq ! ( script_p2pkh. dust_value( ) , crate :: Amount :: from_sat( 546 ) ) ;
14631463 }
14641464
14651465 #[ test]
0 commit comments