btc converter, publisher, and indexer unit tests

This commit is contained in:
Ian Norden
2020-02-20 16:14:17 -06:00
parent 8643a7f3b6
commit 642e08a04b
29 changed files with 1286 additions and 171 deletions
@@ -5,9 +5,8 @@ CREATE TABLE btc.header_cids (
block_hash VARCHAR(66) NOT NULL,
parent_hash VARCHAR(66) NOT NULL,
cid TEXT NOT NULL,
version INTEGER NOT NULL,
timestamp INTEGER NOT NULL,
bits INTEGER NOT NULL,
timestamp NUMERIC NOT NULL,
bits BIGINT NOT NULL,
UNIQUE (block_number, block_hash)
);
@@ -1,12 +1,12 @@
-- +goose Up
CREATE TABLE btc.tx_inputs (
id SERIAL PRIMARY KEY,
tx_id INTEGER NOT NULL REFERENCES btc.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
index INTEGER NOT NULL,
witness BYTEA[],
sig_script BYTEA NOT NULL,
outpoint_tx_id INTEGER NOT NULL REFERENCES btc.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
outpoint_index INTEGER NOT NULL,
id SERIAL PRIMARY KEY,
tx_id INTEGER NOT NULL REFERENCES btc.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
index INTEGER NOT NULL,
witness BYTEA[],
sig_script BYTEA NOT NULL,
outpoint_tx_hash VARCHAR(66) REFERENCES btc.transaction_cids (tx_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
outpoint_index BIGINT NOT NULL,
UNIQUE (tx_id, index)
);
@@ -3,7 +3,7 @@ CREATE TABLE btc.tx_outputs (
id SERIAL PRIMARY KEY,
tx_id INTEGER NOT NULL REFERENCES btc.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
index INTEGER NOT NULL,
value INTEGER NOT NULL,
value BIGINT NOT NULL,
pk_script BYTEA NOT NULL,
script_class INTEGER NOT NULL,
addresses VARCHAR(66)[],