Block categorization (#110)

* Add block categorization (is_final=)

* Add godo task for vulcanizeDB (Example of how everything could work together)

* Add unique constraint on block_number and node

* Add index on block_id for transactions_table

* Add node_id index on blocks table

* Sort transactions returned from FindBlock by tx_hash

* lowercase tx_to, tx_from like etherscan
This commit is contained in:
Matt K
2017-12-20 14:06:22 -06:00
committed by GitHub
parent 266c9587c8
commit 24bc83a448
26 changed files with 239 additions and 86 deletions
@@ -0,0 +1,2 @@
ALTER TABLE blocks
DROP COLUMN is_final;
@@ -0,0 +1,2 @@
ALTER TABLE blocks
ADD COLUMN is_final BOOLEAN;
@@ -0,0 +1,2 @@
ALTER TABLE blocks
DROP CONSTRAINT node_id_block_number_uc;
@@ -0,0 +1,2 @@
ALTER TABLE blocks
ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id);
@@ -0,0 +1 @@
DROP INDEX block_id_index;
@@ -0,0 +1 @@
CREATE INDEX block_id_index ON transactions (block_id);
@@ -0,0 +1 @@
DROP INDEX node_id_index;
@@ -0,0 +1 @@
CREATE INDEX node_id_index ON blocks (node_id);
+24 -1
View File
@@ -50,7 +50,8 @@ CREATE TABLE blocks (
block_parenthash character varying(66),
block_size bigint,
uncle_hash character varying(66),
node_id integer NOT NULL
node_id integer NOT NULL,
is_final boolean
);
@@ -283,6 +284,14 @@ ALTER TABLE ONLY logs
ADD CONSTRAINT logs_pkey PRIMARY KEY (id);
--
-- Name: blocks node_id_block_number_uc; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY blocks
ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id);
--
-- Name: nodes node_uc; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -323,6 +332,13 @@ ALTER TABLE ONLY watched_contracts
ADD CONSTRAINT watched_contracts_pkey PRIMARY KEY (contract_id);
--
-- Name: block_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX block_id_index ON transactions USING btree (block_id);
--
-- Name: block_number_index; Type: INDEX; Schema: public; Owner: -
--
@@ -330,6 +346,13 @@ ALTER TABLE ONLY watched_contracts
CREATE INDEX block_number_index ON blocks USING btree (block_number);
--
-- Name: node_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX node_id_index ON blocks USING btree (node_id);
--
-- Name: transactions blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--