Fix query and add debug logs.
This commit is contained in:
parent
7eb7849b5e
commit
e81da697bc
@ -1,26 +1,18 @@
|
|||||||
-- +goose Up
|
-- +goose Up
|
||||||
-- +goose StatementBegin
|
-- +goose StatementBegin
|
||||||
-- returns if a state leaf node was removed within the provided block number
|
-- returns if a state leaf node was removed within the provided block number
|
||||||
CREATE OR REPLACE FUNCTION was_state_leaf_removed(key character varying, hash character varying) RETURNS boolean
|
CREATE OR REPLACE FUNCTION was_state_leaf_removed(key character varying, hash character varying)
|
||||||
LANGUAGE plpgsql
|
RETURNS boolean AS $$
|
||||||
AS $$
|
SELECT state_cids.node_type = 3
|
||||||
DECLARE
|
FROM eth.state_cids
|
||||||
rec RECORD;
|
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.id)
|
||||||
BEGIN
|
WHERE state_leaf_key = key
|
||||||
FOR rec IN SELECT state_cids.node_type
|
AND block_number <= (SELECT block_number
|
||||||
FROM eth.state_cids
|
FROM eth.header_cids
|
||||||
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.id)
|
WHERE block_hash = hash)
|
||||||
WHERE state_leaf_key = key
|
ORDER BY block_number DESC LIMIT 1;
|
||||||
AND block_number <= (SELECT block_number FROM eth.header_cids WHERE block_hash = hash)
|
$$
|
||||||
ORDER BY state_cids.id DESC LIMIT 1
|
language sql;
|
||||||
LOOP
|
|
||||||
IF rec.node_type = 3 THEN
|
|
||||||
RETURN TRUE;
|
|
||||||
END IF;
|
|
||||||
END LOOP;
|
|
||||||
RETURN FALSE;
|
|
||||||
END;
|
|
||||||
$$;
|
|
||||||
-- +goose StatementEnd
|
-- +goose StatementEnd
|
||||||
|
|
||||||
-- +goose StatementBegin
|
-- +goose StatementBegin
|
||||||
|
@ -39,6 +39,7 @@ services:
|
|||||||
- vdb_db_eth_server:/var/lib/postgresql/data
|
- vdb_db_eth_server:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8077:5432"
|
- "127.0.0.1:8077:5432"
|
||||||
|
command: ["postgres", "-c", "log_statement=all"]
|
||||||
|
|
||||||
eth-server:
|
eth-server:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
Loading…
Reference in New Issue
Block a user