@@ -21,7 +21,7 @@ use std::collections::HashMap;
2121use bitcoin:: { self , BitcoinHash , Txid , VarInt } ;
2222use bitcoin:: blockdata:: opcodes;
2323use bitcoin:: blockdata:: script:: { Script , Instruction } ;
24- use bitcoin:: hashes:: { Hash , sha256 , sha256d } ;
24+ use bitcoin:: hashes:: Hash ;
2525
2626use confidential;
2727use encode:: { self , Encodable , Decodable } ;
@@ -280,7 +280,7 @@ impl TxIn {
280280 } ,
281281 value : opt_try ! ( bitcoin:: consensus:: deserialize( & self . witness. pegin_witness[ 0 ] ) ) ,
282282 asset : confidential:: Asset :: Explicit (
283- opt_try ! ( bitcoin :: consensus :: deserialize( & self . witness. pegin_witness[ 1 ] ) ) ,
283+ opt_try ! ( encode :: deserialize( & self . witness. pegin_witness[ 1 ] ) ) ,
284284 ) ,
285285 genesis_hash : opt_try ! ( bitcoin:: consensus:: deserialize( & self . witness. pegin_witness[ 2 ] ) ) ,
286286 claim_script : & self . witness . pegin_witness [ 3 ] ,
@@ -617,7 +617,6 @@ impl Transaction {
617617
618618 /// Get the total transaction fee in the given asset.
619619 pub fn fee_in ( & self , asset : AssetId ) -> u64 {
620- let asset = sha256d:: Hash :: from_inner ( asset. into_inner ( ) . into_inner ( ) ) ;
621620 // is_fee checks for explicit asset and value, so we can unwrap them here.
622621 self . output . iter ( )
623622 . filter ( |o| o. is_fee ( ) && o. asset . explicit ( ) . expect ( "is_fee" ) == asset)
@@ -630,8 +629,7 @@ impl Transaction {
630629 let mut fees = HashMap :: new ( ) ;
631630 for out in self . output . iter ( ) . filter ( |o| o. is_fee ( ) ) {
632631 // is_fee checks for explicit asset and value, so we can unwrap them here.
633- let asset = out. asset . explicit ( ) . expect ( "is_fee" ) . into_inner ( ) ;
634- let asset = AssetId :: from_inner ( sha256:: Midstate :: from_inner ( asset) ) ;
632+ let asset = out. asset . explicit ( ) . expect ( "is_fee" ) ;
635633 let entry = fees. entry ( asset) . or_insert ( 0 ) ;
636634 * entry += out. value . explicit ( ) . expect ( "is_fee" ) ;
637635 }
@@ -719,7 +717,6 @@ impl Decodable for Transaction {
719717mod tests {
720718 use bitcoin:: { self , BitcoinHash } ;
721719 use bitcoin:: hashes:: hex:: FromHex ;
722- use bitcoin:: hashes:: sha256d;
723720
724721 use encode:: serialize;
725722 use confidential;
@@ -1222,7 +1219,7 @@ mod tests {
12221219 } )
12231220 ) ;
12241221
1225- let expected_asset_id = sha256d :: Hash :: from_hex ( "630ed6f9b176af03c0cd3f8aa430f9e7b4d988cf2d0b2f204322488f03b00bf8" ) . unwrap ( ) ;
1222+ let expected_asset_id = AssetId :: from_hex ( "630ed6f9b176af03c0cd3f8aa430f9e7b4d988cf2d0b2f204322488f03b00bf8" ) . unwrap ( ) ;
12261223 if let confidential:: Asset :: Explicit ( asset_id) = tx. output [ 0 ] . asset {
12271224 assert_eq ! ( expected_asset_id, asset_id) ;
12281225 } else {
0 commit comments