diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs index 9d8eedaa144..0e37eb006cc 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs @@ -469,24 +469,24 @@ computeTxSize proxy witTag action cs = where chaff = L8.pack (show ix) <> BL.fromStrict txid - byronWits = Set.map dummyWitnessUniq $ Set.fromList (fst <$> CS.inputs cs) + byronWits = Set.map dummyWitnessUniq $ Set.fromList (CS.inputs cs) where - dummyWitness :: BL.ByteString -> SL.BootstrapWitness TPraosStandardCrypto - dummyWitness chaff = + dummyWitness :: BL.ByteString -> Address -> SL.BootstrapWitness TPraosStandardCrypto + dummyWitness chaff addr = SL.makeBootstrapWitness credential signingKey addrAttr where credential = Hash.UnsafeHash $ L8.toStrict chaff addrAttr = Byron.mkAttributes $ Byron.AddrAttributes - (Just $ Byron.HDAddressPayload (bloatChaff keyLen)) + (toHDPayloadAddress addr) (toByronNetworkMagic mainnetMagic) (Just xprv) = xprvFromBytes (bloatChaff sigLen) signingKey = Crypto.SigningKey xprv sigLen = sizeSigDSIGN $ Proxy @(DSIGN TPraosStandardCrypto) - keyLen = sizeVerKeyDSIGN $ Proxy @(DSIGN TPraosStandardCrypto) bloatChaff n = BL.toStrict $ BL.take (fromIntegral n) $ BL.cycle chaff - dummyWitnessUniq :: TxIn -> SL.BootstrapWitness TPraosStandardCrypto - dummyWitnessUniq (TxIn (Hash txid) ix) = dummyWitness chaff + dummyWitnessUniq :: (TxIn, TxOut) -> SL.BootstrapWitness TPraosStandardCrypto + dummyWitnessUniq (TxIn (Hash txid) ix, TxOut addr _) = + dummyWitness chaff addr where chaff = L8.pack (show ix) <> BL.fromStrict txid @@ -585,8 +585,8 @@ mkByronWitness -> SL.BootstrapWitness TPraosStandardCrypto mkByronWitness body protocolMagic addr (prv, pwd) = let (SL.TxId txHash) = SL.txid body - (Just signed) = xprvFromBytes (serialize' txHash `signWith` (prv, pwd)) - signingKey = Crypto.SigningKey signed + --(Just signed) = xprvFromBytes (serialize' txHash `signWith` (prv, pwd)) + signingKey = Crypto.SigningKey prv addrAttr = Byron.mkAttributes $ Byron.AddrAttributes (toHDPayloadAddress addr) (toByronNetworkMagic protocolMagic) diff --git a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index a830a280f6d..119a8fa987f 100644 --- a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -193,7 +193,8 @@ prop_decodeSignedByronTxRoundtrip (DecodeByronSetup utxo outs slotNo magic pairs let inps = Map.toList $ getUTxO utxo let cs = mempty { CS.inputs = inps, CS.outputs = outs } let unsigned = mkUnsignedTx slotNo cs mempty [] - let byronWits = Set.fromList $ map (mkByronWitness unsigned magic) pairs + let byronWits = + Set.fromList $ zipWith (\((_, TxOut addr _)) pair -> mkByronWitness unsigned magic addr pair) inps pairs let metadata = SL.SNothing let wits = SL.WitnessSet mempty mempty byronWits let ledgerTx = SL.Tx unsigned wits metadata