anchor.diff:                  #{<<"status">> := <<"error">>, <<"reason">> := <<"io_error">>} ->
                       {error, io_error}
               end;
  +        {error, worker_died} ->
  +            gen_server:reply(From, {error, worker_died}),
  +            exit(self(), kill);
           {error, worker_timeout} ->
               {error, worker_timeout}
       end.
  
positive.code:     receive
          {Port, {exit_status, Status}} ->
              lager:error("Worker process at port ~p died with status: ~p", [Port, Status]),
              exit(worker_died);
          {Port, {data, <<Size:32/integer-signed-little,Msg/binary>>}} ->
              {ok, {Size, Msg}}
      after
  
negative.code:                 #{<<"status">> := <<"error">>, <<"reason">> := _Reason} ->
                      {error, invalid_macaroon}
              end;
          {error, worker_died} ->
              gen_server:reply(From, {error, worker_died}),
              exit(self(), kill);
          {error, _} ->
              {error, invalid_macaroon}
      end.
  
  
  -spec p_submit_payload(SubmissionData, Secret, WorkerPort, From, Timeout) -> submit_payload_result()
                                                      when SubmissionData :: payload_submission_data(),
                                                           Secret :: binary(),
                                                           WorkerPort :: port(),
                                                           From :: pid(),
                                                           Timeout :: integer().
  p_submit_payload({LeaseToken, Payload, Digest, HeaderSize}, Secret, WorkerPort, From, Timeout) ->
      Req1 = jsx:encode(#{<<"token">> => LeaseToken, <<"secret">> => Secret}),
      p_write_request(WorkerPort, ?kCheckToken, Req1),
      case p_read_reply(WorkerPort, Timeout) of
  