Skip to content

Commit cb6e708

Browse files
committed
Don't sign an empty commit
1 parent 0fd5d53 commit cb6e708

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

hydra-tui/src/Hydra/Client.hs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,18 @@ withClient Options{hydraNodeHost = Host{hostname, port}, cardanoSigningKey, card
120120
runReq defaultHttpConfig request
121121
<&> responseBody
122122
>>= \DraftCommitTxResponse{commitTx} ->
123-
case cardanoConnection of
124-
Left bfProject -> do
125-
prj <- liftIO $ BF.projectFromFile bfProject
126-
void $ BF.runBlockfrostM prj $ BF.submitTransaction $ signTx sk commitTx
127-
Right socketPath ->
128-
submitTransaction cardanoNetworkId socketPath $ signTx sk commitTx
123+
let tx =
124+
-- Don't sign the tx if there's nothing to commit (i.e. empty
125+
-- commit).
126+
if payload == mempty
127+
then commitTx
128+
else signTx sk commitTx
129+
in case cardanoConnection of
130+
Left bfProject -> do
131+
prj <- liftIO $ BF.projectFromFile bfProject
132+
void $ BF.runBlockfrostM prj $ BF.submitTransaction tx
133+
Right socketPath ->
134+
submitTransaction cardanoNetworkId socketPath tx
129135
where
130136
request =
131137
Req.req

0 commit comments

Comments
 (0)