Correct the parsing of the tx hash in `TxIn`

This commit is contained in:
Rene Vergara 2024-04-05 14:12:39 -05:00
parent a06fd08172
commit 5814cb7c9e
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 13 additions and 1 deletions

View File

@ -160,7 +160,7 @@ fromRawTxIn t = H.TxIn op (rti_script t) (rti_seq t)
then H.nullOutPoint
else H.OutPoint
((fromJust .
H.hexToTxHash . toText . hexString . rop_hash . rti_outpoint)
H.hexToTxHash . toText . fromRawBytes . rop_hash . rti_outpoint)
t)
(rop_n $ rti_outpoint t)

View File

@ -832,6 +832,18 @@ main = do
Just t' -> do
let ob = zt_oBundle t'
fromRawOBundle ob `shouldNotBe` Nothing
describe "Raw transaction with Transparent inputs" $ do
let h =
hexString
"0400008085202f89014b6ded3d2ee43e54135c04f9a305b473d7d741bbe6f383aa636e03e948705e0d01000000fdfd0000483045022100b34ca0fb34959230b95a48e9de95521dc4c013bdc0e6bd2a77a67b373fadea42022030a1b13f16993ab212d9f674b7b8dd3c6723137c183dbd41a9bbfcf66d7811c40147304402200f0bd12663a52ccb5e6211ec633932bbc7f0151ab51194038534abf88f689025022051fe62591dfa11a96095b4aeee2114c77a0d773242939f7ac2fa8e5262ff0865014c6952210231ee0c161e846bc133ad41d295f560d7e24829415afc78ead24d4b10198bb7342103b0b11f2dd10611d06cd6232233678dce736ce2b2141c62bdf0b4fe6f79d736da21029cbeda22b05352f66a338561604cbe11e8332f836385f16abf5088045c39d4dd53aefdffffff02b63500000000000017a91499a8b5b1f3d3a1a12e92dd4f3d94bee8fc34c527873362fa020000000017a914d75fe4791fcd50f2874f1b7457fca5833293b3a38700000000000000000000000000000000000000"
let t = readZebraTransaction h
it "TxIn parsing" $ do
case t of
Nothing -> assertFailure "Couldn't decode"
Just t' -> do
let tb = zt_tBundle t'
print tb
show tb `shouldNotBe` ""
-- | Properties
prop_PhraseLength :: Property