Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize time between sortitions and block-acceptance #2989

Merged
merged 100 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
589c68b
chore: pass ibd status to relayer
jcnelson Dec 8, 2021
7fdc3ac
fix: don't send blocksavailable messages while in ibd (#1661)
jcnelson Dec 8, 2021
1677624
fix: pass thru sync_comms so the relayer thread can be aware of ibd s…
jcnelson Dec 8, 2021
eed9150
feat: attempt to process sortitions in parallel to downloading burnch…
jcnelson Dec 8, 2021
8e31cdb
Merge branch 'feat/appchain-network-improvements' into feat/faster-bo…
jcnelson Dec 8, 2021
07bec65
fix: don't query the spv headers database if we don't need to when ch…
jcnelson Jan 9, 2022
425b700
fix: remove full inv sync setting; add fault injection for block/micr…
jcnelson Jan 9, 2022
2e2f9d5
chore: test-debug DNS resolution
jcnelson Jan 9, 2022
508420e
fix: less-verbose debug output
jcnelson Jan 9, 2022
3b27521
fix: remove full inv sync logic, and fix a bug in which we calculate …
jcnelson Jan 9, 2022
7023db4
fix: default to 127.0.0.1 instead of localhost for test data URLs, si…
jcnelson Jan 9, 2022
cf93181
chore: fix compiler warning
jcnelson Jan 9, 2022
b5155e0
fix: pass block and microblock data for pushing when receiving a comm…
jcnelson Jan 9, 2022
5b30a82
feat: when we receive a block or microblock stream that we know an ou…
jcnelson Jan 9, 2022
19095d1
chore: whitespace
jcnelson Jan 9, 2022
0944837
refactor: don't re-instantiate the BitcoinIndexer over and over; keep…
jcnelson Jan 9, 2022
56fcf39
feat: advertize a block directly after we mine it
jcnelson Jan 9, 2022
6112cac
fix: correct comment
jcnelson Jan 9, 2022
798958d
Merge branch 'develop' into feat/faster-bootup
jcnelson Jan 9, 2022
803686c
fix: by default, run antientropy protocol once a minute. it's not tha…
jcnelson Jan 9, 2022
f2209c2
fix: compile errors from develop merge; make it so antientropy protoc…
jcnelson Jan 9, 2022
e9b7034
fix: remove full inventory sync config option
jcnelson Jan 9, 2022
1242a47
feat: push the mined block directly to neighbors
jcnelson Jan 9, 2022
419196f
fix: correct exit condition with new burnchain sync loop so that we d…
jcnelson Jan 10, 2022
5407d08
feat: add trait to burnchain controller to query the total height of …
jcnelson Jan 10, 2022
5b70e00
fix: pass absolute burnchain block height to pox sync watchdog so we …
jcnelson Jan 10, 2022
bf91a4f
Merge branch 'develop' into feat/faster-bootup
jcnelson Jan 15, 2022
876f4ee
fix: add index on burnchain block data
jcnelson Jan 15, 2022
66e6133
chore: backport #3005
jcnelson Jan 16, 2022
6b03e70
fix: use microblock frequency to determine frequency of attempted mic…
jcnelson Jan 16, 2022
507c16f
fix: don't attempt to process tenures if the last-processed sortition…
jcnelson Jan 16, 2022
c702ea3
chore: add test code to track missed tenures
jcnelson Jan 16, 2022
8b7e3d0
feat: test that we correctly skip sortitions if the last sortition di…
jcnelson Jan 16, 2022
73c5308
fix: don't keep bumping the assumed burnchain height after we passed …
jcnelson Jan 16, 2022
f128eed
feat: add microblock miner deadline, independent of anchored block mi…
jcnelson Jan 17, 2022
fc77d39
fix: advance target burnchain height to start of next reward cycle, o…
jcnelson Jan 17, 2022
1989b46
fix: set high microblock deadline
jcnelson Jan 17, 2022
12866c4
feat: add indexes to remove table scans in hot paths in the sortition…
jcnelson Jan 17, 2022
a16c74f
fix: lengthen microblock miner deadline
jcnelson Jan 17, 2022
f7968b5
fix: if we can't process a full range of headers due to a reorg, drop…
jcnelson Jan 18, 2022
a33266b
feat: add a few indexes to the sortition DB to remove table scans dur…
jcnelson Jan 18, 2022
0df9dc5
feat: add a staging microblock index to avoid a temporary b-tree
jcnelson Jan 18, 2022
591cd19
feat: add a couple indexes to avoid temporary b-trees
jcnelson Jan 18, 2022
4cc232b
feat: add BLOCKSTACK_DB_TRACE testing envar to get all DB calls to pr…
jcnelson Jan 18, 2022
235adf4
refactor: remove old NeonNode imports
jcnelson Jan 18, 2022
1c234c0
refactor: remove NeonGenesisNode and InitializedNeonNode in favor of …
jcnelson Jan 18, 2022
108497f
refactor: consolidate counters and other free state into RunLoop, and…
jcnelson Jan 18, 2022
4e1efce
fix: bump wait times for bitcoind forking test to make it more reliable
jcnelson Jan 18, 2022
1d5c485
Merge branch 'develop' into feat/faster-bootup
jcnelson Jan 18, 2022
513bbfa
fix: compile wihout test
jcnelson Jan 18, 2022
9f477d2
fix: stop streaming txs after sending one (so we don't stall the p2p …
jcnelson Jan 19, 2022
a13a30b
fix: make mempool timeouts longer, since they're not on the p2p criti…
jcnelson Jan 19, 2022
deeaef3
fix: abort a block-commit if the burnchain or stacks chain tips change
jcnelson Jan 19, 2022
02de1eb
chore: clean up imports
jcnelson Jan 19, 2022
8266b8c
feat: Yield(u64) error variant, for when a StreamCursor has more data…
jcnelson Jan 19, 2022
faec7a0
fix: once we send one transaction successfully, yield the connection …
jcnelson Jan 19, 2022
868c012
chore: API sync with Yield(..)
jcnelson Jan 19, 2022
a89da2b
fix: when a StreamCursor returns Yield(..), propagate a bool up to th…
jcnelson Jan 19, 2022
2cf6b69
feat: when building a tx stream, pass in the hashed txid as a page ID
jcnelson Jan 19, 2022
1c287ba
fix: make it so that a tx stream can be corked prematurely with a nex…
jcnelson Jan 19, 2022
1422e6f
fix: remove Yield error variant, since we need to always saturate a s…
jcnelson Jan 19, 2022
2cd7165
feat: update the tx-streaming logic so that if we either make a pass …
jcnelson Jan 19, 2022
714419a
chore: expand test coverage to the new paginated mempool streaming in…
jcnelson Jan 19, 2022
b30c90e
feat: limit the number of rows considered per mempool query to 128, n…
jcnelson Jan 19, 2022
ce2ba44
feat: implement mempool pagination. /v2/mempool/query can take a `?p…
jcnelson Jan 19, 2022
ef3248c
chore: update MemPool HTTP types to contain an optional page ID
jcnelson Jan 19, 2022
989cb3a
feat: when doing a mempool sync, page through the mempool with the re…
jcnelson Jan 19, 2022
1346693
chore: remove Yield-handling logic (since it's unworkable), and updat…
jcnelson Jan 19, 2022
f3c53c4
fix: fix a bug in the RetryReader so it correctly calculates the stre…
jcnelson Jan 19, 2022
1a6b537
fix: don't stall the stream when we cork it
jcnelson Jan 20, 2022
f4da53c
fix: the next page will be None if there were no transactions considered
jcnelson Jan 20, 2022
c40ccdc
chore: elevate some trace!() messages to test_debug!() to identify st…
jcnelson Jan 20, 2022
d1a9909
fix: more consistent mempool sync logging; add mempool sync test that…
jcnelson Jan 20, 2022
28b6808
fix: more consistent logging; elevate some trace()'s to test_debug!()'s
jcnelson Jan 20, 2022
6a6e01f
chore: run flashblock integration test
jcnelson Jan 21, 2022
ce9cf63
chore: add CHANGELOG entries for this PR
jcnelson Jan 21, 2022
c104f2f
chore: document microblock_attempt_time_ms
jcnelson Jan 21, 2022
c5dd409
chore: k/v logging and elevate test_debug!() to debug!()
jcnelson Jan 21, 2022
9b4f95a
chore: increase mempool sync timeout
jcnelson Jan 21, 2022
154d4d4
refactor: use EndOfStreamExpected error variant
jcnelson Jan 21, 2022
f027e9a
refactor: add EndOfStreamExpected error variant for streaming
jcnelson Jan 21, 2022
d7d2438
chore: use k/v logging
jcnelson Jan 21, 2022
8ba51d0
chore: use k/v logging
jcnelson Jan 21, 2022
700cef5
chore: #[cfg(test)] for test-only method
jcnelson Jan 21, 2022
a9b6212
refactor: microblock_mine_attempt_ms is a miner setting, not a node s…
jcnelson Jan 21, 2022
1705de4
refactor: DRY up last_burn_block and last_sortition_mutex (use the la…
jcnelson Jan 21, 2022
1da2ef3
chore: use k/v logging
jcnelson Jan 21, 2022
a7fbb16
chore: API sync with new config layout; fix flash block test
jcnelson Jan 21, 2022
43e415c
chore: cargo fmt
jcnelson Jan 21, 2022
915a61c
Merge branch 'develop' into feat/faster-bootup
kantai Jan 22, 2022
56da2d4
refactor: track and log pagination data; consolidate some logs
jcnelson Jan 24, 2022
0a3d54b
tests: expand coverage for ExpectedEndOfStream error cases and for va…
jcnelson Jan 24, 2022
e27f2a6
refactor: test_debug!() on ExpectedEndOfStream
jcnelson Jan 24, 2022
58743b7
fix: add a few more indexes after finding some rarer table scans
jcnelson Jan 24, 2022
3e6f365
Merge branch 'feat/faster-bootup' of https://github.com/stacks-networ…
jcnelson Jan 24, 2022
d35d302
fix: set first-attempt to 5s and subsequent-attempt to 180s by default
jcnelson Jan 24, 2022
7dc2079
fix: give the microblock integration test time to build a microblock …
jcnelson Jan 25, 2022
724030e
docs: document mempool_sync_* timeouts
jcnelson Jan 25, 2022
c422db5
chore: address PR feedback
jcnelson Jan 26, 2022
c395794
Merge branch 'develop' into feat/faster-bootup
jcnelson Jan 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window5
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window10
- tests::neon_integrations::use_latest_tip_integration_test
- tests::neon_integrations::test_flash_block_skip_tenure
- tests::epoch_205::test_dynamic_db_method_costs
- tests::epoch_205::transition_empty_blocks
- tests::epoch_205::test_cost_limit_switch_version205
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
sync, the p2p state machine will immediately transition from the inventory sync
work state to the block downloader work state, and immediately proceed to fetch
the available block or microblock stream. (#2862)
- Nodes will push recently-obtained blocks and microblock streams to outbound
neighbors if their cached inventories indicate that they do not yet have them
(#2986).
- Nodes will no longer perform full inventory scans on their peers, except
during boot-up, in a bid to minimize block-download stalls (#2986).
- Nodes will process sortitions in parallel to downloading the Stacks blocks for
a reward cycle, instead of doing these tasks sequentially (#2986).
- The node's runloop will coalesce and expire stale requests to mine blocks on
top of parent blocks that are no longer the chain tip (#2969).
- Several database indexes have been updated to avoid table scans, which
significantly improves most RPC endpoint speed and cuts node spin-up time in
half (#2989, #3005).
- Fixed a rare denial-of-service bug whereby a node that processes a very deep
burnchain reorg can get stuck, and be rendered unable to process further
sortitions. This has never happened in production, but it can be replicated in
tests (#2989).

### Fixed
- Updates the lookup key for contracts in the pessimistic cost estimator. Before, contracts
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,14 @@ wait_time_for_microblocks = 10000
[miner]
# Smallest allowed tx fee, in microSTX
min_tx_fee = 100
# Time to spend on the first attempt to make a block.
# Time to spend on the first attempt to make a block, in milliseconds.
# This can be small, so your node gets a block-commit into the Bitcoin mempool early.
first_attempt_time_ms: 1000
# Time to spend on subsequent attempts to make a block.
first_attempt_time_ms = 1000
# Time to spend on subsequent attempts to make a block, in milliseconds.
# This can be bigger -- new block-commits will be RBF'ed.
subsequent_attempt_time_ms: 60000
subsequent_attempt_time_ms = 60000
# Time to spend mining a microblock, in milliseconds.
microblock_attempt_time_ms = 30000
```

You can verify that your node is operating as a miner by checking its log output
Expand Down
8 changes: 8 additions & 0 deletions src/burnchains/bitcoin/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,14 @@ impl BitcoinIndexer {
true,
false,
)?;
if let Some(last_block) = last_block.as_ref() {
// do we need to do anything?
let cur_height = spv_client.get_headers_height()?;
if *last_block <= cur_height {
debug!("SPV client has all headers up to {}", cur_height);
return Ok(cur_height);
}
}
spv_client
.run(self)
.and_then(|_r| Ok(spv_client.end_block_height.unwrap()))
Expand Down
3 changes: 3 additions & 0 deletions src/burnchains/burnchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,9 @@ impl Burnchain {
start_block + max_blocks
);
end_block = start_block + max_blocks;

// make sure we resume at this height next time
indexer.drop_headers(end_block.saturating_sub(1))?;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/burnchains/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ CREATE TABLE burnchain_db_block_headers (

PRIMARY KEY(block_hash)
);
CREATE INDEX index_burnchain_db_block_headers_height_hash ON burnchain_db_block_headers(block_height DESC, block_hash ASC);

CREATE TABLE burnchain_db_block_ops (
block_hash TEXT NOT NULL,
Expand All @@ -130,6 +131,9 @@ CREATE TABLE burnchain_db_block_ops (
FOREIGN KEY(block_hash) REFERENCES burnchain_db_block_headers(block_hash)
);

CREATE INDEX index_burnchain_db_block_hash ON burnchain_db_block_ops(block_hash);
CREATE INDEX index_burnchain_db_txid ON burnchain_db_block_ops(txid);

CREATE TABLE db_config(version TEXT NOT NULL);";

impl<'a> BurnchainDBTransaction<'a> {
Expand Down
27 changes: 24 additions & 3 deletions src/chainstate/burn/db/sortdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
FOREIGN KEY(sortition_id) REFERENCES snapshots(sortition_id)
);"#,
r#"
CREATE INDEX index_leader_keys_sortition_id_block_height_vtxindex ON leader_keys(sortition_id,block_height,vtxindex);
"#,
r#"
CREATE TABLE block_commits(
txid TEXT NOT NULL,
vtxindex INTEGER NOT NULL,
Expand All @@ -540,6 +543,10 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
FOREIGN KEY(sortition_id) REFERENCES snapshots(sortition_id)
);"#,
r#"
CREATE INDEX index_block_commits_sortition_id_vtxindex ON block_commits(sortition_id,vtxindex);
CREATE INDEX index_block_commits_sortition_id_block_height_vtxindex ON block_commits(sortition_id,block_height,vtxindex);
"#,
r#"
CREATE TABLE user_burn_support(
txid TEXT NOT NULL,
vtxindex INTEGER NOT NULL,
Expand All @@ -560,6 +567,11 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
FOREIGN KEY(sortition_id) REFERENCES snapshots(sortition_id)
);"#,
r#"
CREATE INDEX index_user_burn_support_txid ON user_burn_support(txid);
CREATE INDEX index_user_burn_support_sortition_id_vtxindex ON user_burn_support(sortition_id,vtxindex);
CREATE INDEX index_user_burn_support_sortition_id_hash_160_key_vtxindex_key_block_ptr_vtxindex ON user_burn_support(sortition_id,block_header_hash_160,key_vtxindex,key_block_ptr,vtxindex ASC);
"#,
r#"
CREATE TABLE stack_stx (
txid TEXT NOT NULL,
vtxindex INTEGER NOT NULL,
Expand All @@ -574,6 +586,9 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
PRIMARY KEY(txid)
);"#,
r#"
CREATE INDEX index_stack_stx_burn_header_hash ON stack_stx(burn_header_hash);
"#,
r#"
CREATE TABLE transfer_stx (
txid TEXT NOT NULL,
vtxindex INTEGER NOT NULL,
Expand All @@ -588,6 +603,9 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
PRIMARY KEY(txid)
);"#,
r#"
CREATE INDEX index_transfer_stx_burn_header_hash ON transfer_stx(burn_header_hash);
"#,
r#"
CREATE TABLE missed_commits (
txid TEXT NOT NULL,
input TEXT NOT NULL,
Expand All @@ -596,6 +614,9 @@ const SORTITION_DB_INITIAL_SCHEMA: &'static [&'static str] = &[
PRIMARY KEY(txid, intended_sortition_id)
);"#,
r#"
CREATE INDEX index_missed_commits_intended_sortition_id ON missed_commits(intended_sortition_id);
"#,
r#"
CREATE TABLE canonical_accepted_stacks_blocks(
tip_consensus_hash TEXT NOT NULL,
consensus_hash TEXT NOT NULL,
Expand Down Expand Up @@ -1574,8 +1595,8 @@ impl<'a> SortitionHandleConn<'a> {
let winning_block_hash160 =
Hash160::from_sha256(snapshot.winning_stacks_block_hash.as_bytes());

let qry = "SELECT * FROM user_burn_support
WHERE sortition_id = ?1 AND block_header_hash_160 = ?2 AND key_vtxindex = ?3 AND key_block_ptr = ?4
let qry = "SELECT * FROM user_burn_support \
WHERE sortition_id = ?1 AND block_header_hash_160 = ?2 AND key_vtxindex = ?3 AND key_block_ptr = ?4 \
ORDER BY vtxindex ASC";
let args: [&dyn ToSql; 4] = [
&snapshot.sortition_id,
Expand All @@ -1587,7 +1608,7 @@ impl<'a> SortitionHandleConn<'a> {
let mut winning_user_burns: Vec<UserBurnSupportOp> = query_rows(self, qry, &args)?;

// were there multiple miners with the same VRF key and block header hash? (i.e., are these user burns shared?)
let qry = "SELECT COUNT(*) FROM block_commits
let qry = "SELECT COUNT(*) FROM block_commits \
WHERE sortition_id = ?1 AND block_header_hash = ?2 AND key_vtxindex = ?3 AND key_block_ptr = ?4";
let args: [&dyn ToSql; 4] = [
&snapshot.sortition_id,
Expand Down
17 changes: 15 additions & 2 deletions src/chainstate/stacks/db/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,26 @@ impl StreamCursor {
}))
}

pub fn new_tx_stream(tx_query: MemPoolSyncData, max_txs: u64, height: u64) -> StreamCursor {
pub fn new_tx_stream(
tx_query: MemPoolSyncData,
max_txs: u64,
height: u64,
page_id_opt: Option<Txid>,
) -> StreamCursor {
let last_randomized_txid = page_id_opt.unwrap_or_else(|| {
let random_bytes = rand::thread_rng().gen::<[u8; 32]>();
Txid(random_bytes)
});

StreamCursor::MempoolTxs(TxStreamData {
tx_query,
last_randomized_txid: Txid([0u8; 32]),
last_randomized_txid: last_randomized_txid,
tx_buf: vec![],
tx_buf_ptr: 0,
num_txs: 0,
max_txs: max_txs,
height: height,
corked: false,
})
}

Expand Down Expand Up @@ -2123,6 +2134,7 @@ impl StacksChainState {
let block_bench_start = get_epoch_time_ms();
let mut parent_microblock_hash = None;

// TODO: just do a stat? cache this?
match StacksChainState::load_block_header(
&self.blocks_path,
&consensus_hash,
Expand Down Expand Up @@ -2150,6 +2162,7 @@ impl StacksChainState {

let mblock_bench_begin = get_epoch_time_ms();
if let Some(parent_microblock) = parent_microblock_hash {
// TODO: can we cache this?
if self.has_processed_microblocks_at_tail(
&index_block_hash,
&parent_microblock,
Expand Down
20 changes: 18 additions & 2 deletions src/chainstate/stacks/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,15 @@ pub struct TxStreamData {
/// serialized transaction buffer that's being sent
pub tx_buf: Vec<u8>,
pub tx_buf_ptr: usize,
/// number of transactions sent so far
/// number of transactions visited in the DB so far
pub num_txs: u64,
/// maximum we can send
/// maximum we can visit in the query
pub max_txs: u64,
/// height of the chain at time of query
pub height: u64,
/// Are we done sending transactions, and are now in the process of sending the trailing page
/// ID?
pub corked: bool,
}

pub const CHAINSTATE_VERSION: &'static str = "2";
Expand Down Expand Up @@ -597,6 +600,7 @@ const CHAINSTATE_INITIAL_SCHEMA: &'static [&'static str] = &[
"CREATE INDEX index_block_hash_to_primary_key ON block_headers(index_block_hash,consensus_hash,block_hash);",
"CREATE INDEX block_headers_hash_index ON block_headers(block_hash,block_height);",
"CREATE INDEX block_index_hash_index ON block_headers(index_block_hash,consensus_hash,block_hash);",
"CREATE INDEX block_headers_burn_header_height ON block_headers(burn_header_height);",
r#"
-- scheduled payments
-- no designated primary key since there can be duplicate entries
Expand All @@ -620,6 +624,10 @@ const CHAINSTATE_INITIAL_SCHEMA: &'static [&'static str] = &[
vtxindex INT NOT NULL -- user burn support vtxindex
);"#,
r#"
CREATE INDEX index_payments_block_hash_consensus_hash_vtxindex ON payments(block_hash,consensus_hash,vtxindex ASC);
CREATE INDEX index_payments_index_block_hash_vtxindex ON payments(index_block_hash,vtxindex ASC);
"#,
r#"
-- users who supported miners
CREATE TABLE user_supporters(
address TEXT NOT NULL,
Expand Down Expand Up @@ -648,7 +656,11 @@ const CHAINSTATE_INITIAL_SCHEMA: &'static [&'static str] = &[
orphaned INT NOT NULL,
PRIMARY KEY(anchored_block_hash,consensus_hash,microblock_hash)
);"#,
"CREATE INDEX staging_microblocks_processed ON staging_microblocks(processed);",
"CREATE INDEX staging_microblocks_orphaned ON staging_microblocks(orphaned);",
"CREATE INDEX staging_microblocks_index_hash ON staging_microblocks(index_block_hash);",
"CREATE INDEX staging_microblocks_index_hash_processed ON staging_microblocks(index_block_hash,processed);",
"CREATE INDEX staging_microblocks_index_hash_orphaned ON staging_microblocks(index_block_hash,orphaned);",
r#"
-- Staging microblocks data
CREATE TABLE staging_microblocks_data(block_hash TEXT NOT NULL,
Expand Down Expand Up @@ -688,6 +700,7 @@ const CHAINSTATE_INITIAL_SCHEMA: &'static [&'static str] = &[
"CREATE INDEX parent_blocks ON staging_blocks(parent_anchored_block_hash);",
"CREATE INDEX parent_consensus_hashes ON staging_blocks(parent_consensus_hash);",
"CREATE INDEX index_block_hashes ON staging_blocks(index_block_hash);",
"CREATE INDEX height_stacks_blocks ON staging_blocks(height);",
r#"
-- users who burned in support of a block
CREATE TABLE staging_user_burn_support(anchored_block_hash TEXT NOT NULL,
Expand All @@ -697,6 +710,9 @@ const CHAINSTATE_INITIAL_SCHEMA: &'static [&'static str] = &[
vtxindex INT NOT NULL
);"#,
r#"
CREATE INDEX index_staging_user_burn_support ON staging_user_burn_support(anchored_block_hash,consensus_hash);
"#,
r#"
CREATE TABLE transactions(
id INTEGER PRIMARY KEY,
txid TEXT NOT NULL,
Expand Down
Loading