Skip to content

Commit

Permalink
Extend the test blockchain with a Tx that spends a collateral output.
Browse files Browse the repository at this point in the history
This transaction is expected to spend a collateral ouput that was
created by a previous transaction, where the previous transaction
was marked as having failed script validation.
  • Loading branch information
jonathanknowles committed Jun 21, 2022
1 parent c10c9f0 commit 98b547b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lib/core/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,46 @@ blockchain =
]
, delegations = []
}

, Block
{ header = BlockHeader
{ slotNo = slot 14 21
, blockHeight = Quantity 302379
, headerHash = Hash "unused"
, parentHeaderHash = Just $ Hash "unused"
}
, transactions =
-- This transaction spends a single collateral output that was
-- created in the previous transaction:
[ Tx
{ txId = Hash "tx-spend-collateral-output"
, fee = Just (Coin 1)
, resolvedInputs =
[ ( TxIn
{ inputId = Hash "tx-create-collateral-output"
-- The previous transaction defined exactly one
-- ordinary output, so we use 1 as the index of
-- the collateral output:
, inputIx = 1
}
, Coin (19999800000 - 1)
)
]
, resolvedCollateralInputs = []
, outputs =
[ TxOut
{ address = Address "\130\216\CANXB\131X\FS\147\ACKn\246.n\DLE\233Y\166)\207c\v\248\183\235\212\EOTV\243h\192\190T\150'\196\161\SOHX\RSX\FS\202>U<\156c\197&\DC3S\235C\198\245\163\204=\214fa\201\t\205\248\204\226r%\NUL\SUB\174\187\&7\t"
, tokens = coinToBundle (19999800000 - 2)
}
]
, collateralOutput = Nothing
, withdrawals = mempty
, metadata = Nothing
, scriptValidity = Just TxScriptValid
}
]
, delegations = []
}
]
where
slot e s = SlotNo $ flatSlot (EpochLength 21600) (SlotId e s)
Expand Down

0 comments on commit 98b547b

Please sign in to comment.