@@ -805,8 +805,9 @@ singlePartyCommitsScriptBlueprint tracer workDir backend hydraScriptsTxId =
805
805
withHydraNode hydraTracer aliceChainConfig workDir hydraNodeId aliceSk [] [1 ] $ \ n1 -> do
806
806
send n1 $ input " Init" []
807
807
headId <- waitMatch (10 * blockTime) n1 $ headIsInitializingWith (Set. fromList [alice])
808
-
809
- (clientPayload, scriptUTxO) <- prepareScriptPayload 3_000_000
808
+ -- NOTE: We don't use amount in _regular_ commits - the ones before the
809
+ -- head is not yet opened - since we will remove this process soon.
810
+ (clientPayload, scriptUTxO) <- prepareScriptPayload 7_000_000 0
810
811
811
812
res <-
812
813
runReq defaultHttpConfig $
@@ -825,8 +826,12 @@ singlePartyCommitsScriptBlueprint tracer workDir backend hydraScriptsTxId =
825
826
guard $ v ^? key " tag" == Just " HeadIsOpen"
826
827
pure $ v ^? key " utxo"
827
828
lockedUTxO `shouldBe` Just (toJSON scriptUTxO)
829
+
828
830
-- incrementally commit script to a running Head
829
- (clientPayload', scriptUTxO') <- prepareScriptPayload 2_000_000
831
+ let commitAmount = 2_000_000
832
+ (clientPayload', scriptUTxO') <- prepareScriptPayload 5_000_000 commitAmount
833
+
834
+ let toCommit = fst $ capUTxO scriptUTxO' (Coin commitAmount)
830
835
831
836
res' <-
832
837
runReq defaultHttpConfig $
@@ -843,13 +848,12 @@ singlePartyCommitsScriptBlueprint tracer workDir backend hydraScriptsTxId =
843
848
Backend. submitTransaction backend tx
844
849
845
850
waitFor hydraTracer (2 * realToFrac depositPeriod) [n1] $
846
- output " CommitApproved" [" headId" .= headId, " utxoToCommit" .= scriptUTxO' ]
851
+ output " CommitApproved" [" headId" .= headId, " utxoToCommit" .= toCommit ]
847
852
waitFor hydraTracer (20 * blockTime) [n1] $
848
853
output " CommitFinalized" [" headId" .= headId, " depositTxId" .= getTxId (getTxBody tx)]
849
-
850
- getSnapshotUTxO n1 `shouldReturn` scriptUTxO <> scriptUTxO'
854
+ getSnapshotUTxO n1 `shouldReturn` scriptUTxO <> toCommit
851
855
where
852
- prepareScriptPayload lovelaceAmt = do
856
+ prepareScriptPayload lovelaceAmt commitAmount = do
853
857
networkId <- Backend. queryNetworkId backend
854
858
let scriptAddress = mkScriptAddress networkId dummyValidatorScript
855
859
let datumHash :: TxOutDatum ctx
@@ -869,6 +873,7 @@ singlePartyCommitsScriptBlueprint tracer workDir backend hydraScriptsTxId =
869
873
( Aeson. object
870
874
[ " blueprintTx" .= spendingTx
871
875
, " utxo" .= scriptUTxO
876
+ , " amount" .= Coin commitAmount
872
877
]
873
878
, scriptUTxO
874
879
)
0 commit comments