Fix canonical_header_id function.
This commit is contained in:
parent
ed183ed182
commit
35f72bc438
@ -129,7 +129,7 @@ $$;
|
||||
-- Name: canonical_header_id(bigint); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.canonical_header_id(height bigint) RETURNS integer
|
||||
CREATE FUNCTION public.canonical_header_id(height bigint) RETURNS character varying
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
@ -149,13 +149,13 @@ BEGIN
|
||||
-- if we have less than 1 header, return NULL
|
||||
IF header_count IS NULL OR header_count < 1 THEN
|
||||
RETURN NULL;
|
||||
-- if we have one header, return its id
|
||||
-- if we have one header, return its hash
|
||||
ELSIF header_count = 1 THEN
|
||||
RETURN headers[1].id;
|
||||
RETURN headers[1].block_hash;
|
||||
-- if we have multiple headers we need to determine which one is canonical
|
||||
ELSE
|
||||
canonical_header = canonical_header_from_array(headers);
|
||||
RETURN canonical_header.id;
|
||||
RETURN canonical_header.block_hash;
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
|
Loading…
Reference in New Issue
Block a user