Documentation
¶
Index ¶
- Constants
- Variables
- func MakeAddressRowInsertStatement(checked bool) string
- func MakeAgendaInsertStatement(checked bool) string
- func MakeBlockInsertStatement(block *dbtypes.Block, checked bool) string
- func MakeMissInsertStatement(checked bool) string
- func MakeTicketInsertStatement(checked bool) string
- func MakeTxInsertStatement(checked bool) string
- func MakeVinCopyInStatement() string
- func MakeVinInsertStatement(checked bool) string
- func MakeVoteInsertStatement(checked bool) string
- func MakeVoutCopyInStatement() string
- func MakeVoutInsertStatement(checked bool) string
Constants ¶
View Source
const ( InsertAddressRow = insertAddressRow0 + `RETURNING id;` UpsertAddressRow = insertAddressRow0 + `ON CONFLICT (tx_vin_vout_row_id, address, is_funding) DO UPDATE SET matching_tx_hash = $2, tx_hash = $3, tx_vin_vout_index = $4, block_time = $7, valid_mainchain = $9 RETURNING id;` InsertAddressRowReturnID = `WITH inserting AS (` + insertAddressRow0 + `ON CONFLICT (tx_vin_vout_row_id, address, is_funding) DO UPDATE SET address = NULL WHERE FALSE RETURNING id ) SELECT id FROM inserting UNION ALL SELECT id FROM addresses WHERE address = $1 AND is_funding = $8 AND tx_vin_vout_row_id = $5 LIMIT 1;` CreateAddressTable = `` /* 285-byte string literal not displayed */ SelectAddressAllByAddress = `SELECT ` + addrsColumnNames + ` FROM addresses WHERE address=$1 ORDER BY block_time DESC;` SelectAddressRecvCount = `SELECT COUNT(*) FROM addresses WHERE address=$1 AND valid_mainchain = TRUE;` SelectAddressesAllTxn = `` /* 300-byte string literal not displayed */ SelectAddressUnspentCountANDValue = `` /* 142-byte string literal not displayed */ SelectAddressSpentCountANDValue = `` /* 141-byte string literal not displayed */ SelectAddressesMergedSpentCount = `SELECT COUNT( DISTINCT tx_hash ) FROM addresses WHERE address = $1 AND is_funding = FALSE AND valid_mainchain = TRUE;` SelectAddressUnspentWithTxn = `` /* 502-byte string literal not displayed */ SelectAddressLimitNByAddress = `SELECT ` + addrsColumnNames + ` FROM addresses WHERE address=$1 AND valid_mainchain = TRUE ORDER BY block_time DESC LIMIT $2 OFFSET $3;` SelectAddressLimitNByAddressSubQry = `WITH these AS (SELECT ` + addrsColumnNames + ` FROM addresses WHERE address=$1 AND valid_mainchain = TRUE) SELECT * FROM these ORDER BY block_time DESC LIMIT $2 OFFSET $3;` SelectAddressMergedDebitView = `` /* 317-byte string literal not displayed */ SelectAddressDebitsLimitNByAddress = `SELECT ` + addrsColumnNames + ` FROM addresses WHERE address=$1 AND is_funding = FALSE AND valid_mainchain = TRUE ORDER BY block_time DESC LIMIT $2 OFFSET $3;` SelectAddressCreditsLimitNByAddress = `SELECT ` + addrsColumnNames + ` FROM addresses WHERE address=$1 AND is_funding = TRUE AND valid_mainchain = TRUE ORDER BY block_time DESC LIMIT $2 OFFSET $3;` SelectAddressIDsByFundingOutpoint = `` /* 132-byte string literal not displayed */ SelectAddressIDByVoutIDAddress = `SELECT id FROM addresses WHERE address=$1 AND tx_vin_vout_row_id=$2 AND is_funding = TRUE;` SetAddressFundingForMatchingTxHash = `UPDATE addresses SET matching_tx_hash=$1 WHERE tx_hash=$2 AND is_funding = TRUE AND tx_vin_vout_index=$3;` SetAddressMainchainForVoutIDs = `UPDATE addresses SET valid_mainchain=$1 WHERE is_funding = TRUE AND tx_vin_vout_row_id=$2;` SetAddressMainchainForVinIDs = `UPDATE addresses SET valid_mainchain=$1 WHERE is_funding = FALSE AND tx_vin_vout_row_id=$2;` SelectAddressOldestTxBlockTime = `SELECT block_time FROM addresses WHERE address=$1 ORDER BY block_time DESC LIMIT 1;` // Rtx defines Regular transactions grouped into (SentRtx and ReceivedRtx), // SSTx defines tickets, SSGen defines votes and SSRtx defines Revocation transactions SelectAddressTxTypesByAddress = `` /* 473-byte string literal not displayed */ SelectAddressAmountFlowByAddress = `` /* 248-byte string literal not displayed */ SelectAddressUnspentAmountByAddress = `` /* 181-byte string literal not displayed */ // SelectAddressesGloballyInvalid selects the row ids of the addresses table // corresponding to transactions that should have valid_mainchain set to // false according to the transactions table. Should is defined as any // occurence of a given transaction (hash) being flagged as is_valid AND // is_mainchain. SelectAddressesGloballyInvalid = `` /* 403-byte string literal not displayed */ // UpdateAddressesGloballyInvalid sets valid_mainchain=false on address rows // identified by the SelectAddressesGloballyInvalid query (ids of // globally_invalid subquery table) as requiring this flag set, but which do // not already have it set (incorrectly_valid). UpdateAddressesGloballyInvalid = `UPDATE addresses SET valid_mainchain=false FROM ( SELECT id FROM ( ` + SelectAddressesGloballyInvalid + ` ) AS invalid_ids WHERE invalid_ids.valid_mainchain=true ) AS incorrectly_valid WHERE incorrectly_valid.id=addresses.id;` // UpdateAddressesFundingMatchingHash sets matching_tx_hash as per the vins // table. This is needed to fix partially updated addresses table entries // that were affected by stake invalidation. UpdateAddressesFundingMatchingHash = `` /* 276-byte string literal not displayed */ // UpdateValidMainchainFromTransactions sets valid_mainchain in all rows of // the addresses table according to the transactions table, unlike // UpdateAddressesGloballyInvalid that does it selectively for only the // incorrectly set addresses table rows. This is much slower. UpdateValidMainchainFromTransactions = `` /* 157-byte string literal not displayed */ SetTxTypeOnAddressesByVinAndVoutIDs = `UPDATE addresses SET tx_type=$1 WHERE tx_vin_vout_row_id=$2 AND is_funding=$3;` IndexBlockTimeOnTableAddress = `CREATE INDEX block_time_index ON addresses (block_time);` DeindexBlockTimeOnTableAddress = `DROP INDEX block_time_index;` IndexMatchingTxHashOnTableAddress = `CREATE INDEX matching_tx_hash_index ON addresses (matching_tx_hash);` DeindexMatchingTxHashOnTableAddress = `DROP INDEX matching_tx_hash_index;` IndexAddressTableOnAddress = `CREATE INDEX uix_addresses_address ON addresses(address);` DeindexAddressTableOnAddress = `DROP INDEX uix_addresses_address;` IndexAddressTableOnVoutID = `CREATE UNIQUE INDEX uix_addresses_vout_id ON addresses(tx_vin_vout_row_id, address, is_funding);` DeindexAddressTableOnVoutID = `DROP INDEX uix_addresses_vout_id;` IndexAddressTableOnTxHash = `CREATE INDEX uix_addresses_funding_tx ON addresses(tx_hash);` DeindexAddressTableOnTxHash = `DROP INDEX uix_addresses_funding_tx;` )
View Source
const ( UpdateLastBlockValid = `UPDATE blocks SET is_valid = $2 WHERE id = $1;` SelectBlockByTimeRangeSQL = `SELECT hash, height, size, time, numtx FROM blocks WHERE time BETWEEN $1 and $2 ORDER BY time DESC LIMIT $3;` SelectBlockByTimeRangeSQLNoLimit = `SELECT hash, height, size, time, numtx FROM blocks WHERE time BETWEEN $1 and $2 ORDER BY time DESC;` SelectBlockHashByHeight = `SELECT hash FROM blocks WHERE height = $1 AND is_mainchain = true;` SelectBlockHeightByHash = `SELECT height FROM blocks WHERE hash = $1;` CreateBlockTable = `` /* 585-byte string literal not displayed */ IndexBlockTableOnHash = `CREATE UNIQUE INDEX uix_block_hash ON blocks(hash);` DeindexBlockTableOnHash = `DROP INDEX uix_block_hash;` RetrieveBestBlock = `SELECT * FROM blocks ORDER BY height DESC LIMIT 0, 1;` RetrieveBestBlockHeightAny = `SELECT id, hash, height FROM blocks ORDER BY height DESC LIMIT 1;` RetrieveBestBlockHeight = `SELECT id, hash, height FROM blocks WHERE is_mainchain = true ORDER BY height DESC LIMIT 1;` // SelectBlocksTicketsPrice selects the ticket price and difficulty for the first block in a stake difficulty window. SelectBlocksTicketsPrice = `SELECT sbits, time, difficulty FROM blocks WHERE height % $1 = 0 ORDER BY time;` SelectBlocksBlockSize = `SELECT time, size, numtx, height FROM blocks ORDER BY time;` SelectBlocksPreviousHash = `SELECT previous_hash FROM blocks WHERE hash = $1;` SelectBlocksHashes = `SELECT hash FROM blocks ORDER BY id;` SelectBlockVoteCount = `SELECT voters FROM blocks WHERE hash = $1;` UpdateBlockMainchain = `UPDATE blocks SET is_mainchain = $2 WHERE hash = $1 RETURNING previous_hash;` IndexBlocksTableOnHeight = `CREATE INDEX uix_block_height ON blocks(height);` DeindexBlocksTableOnHeight = `DROP INDEX uix_block_height;` // block_chain, with primary key that is not a SERIAL CreateBlockPrevNextTable = `` /* 164-byte string literal not displayed */ // Insert includes the primary key, which should be from the blocks table InsertBlockPrevNext = `` /* 135-byte string literal not displayed */ SelectBlockChainRowIDByHash = `SELECT block_db_id FROM block_chain WHERE this_hash = $1;` UpdateBlockNext = `UPDATE block_chain SET next_hash = $2 WHERE block_db_id = $1;` UpdateBlockNextByHash = `UPDATE block_chain SET next_hash = $2 WHERE this_hash = $1;` )
View Source
const ( IndexExists = `SELECT 1 FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = $1 AND n.nspname = $2;` IndexIsUnique = `` /* 167-byte string literal not displayed */ )
View Source
const ( CreateTicketsTable = `` /* 397-byte string literal not displayed */ SelectTicketsInBlock = `SELECT * FROM tickets WHERE block_hash = $1;` SelectTicketsTxDbIDsInBlock = `SELECT purchase_tx_db_id FROM tickets WHERE block_hash = $1;` SelectTicketsForAddress = `SELECT * FROM tickets WHERE stakesubmission_address = $1;` SelectTicketsForPriceAtLeast = `SELECT * FROM tickets WHERE price >= $1;` SelectTicketsForPriceAtMost = `SELECT * FROM tickets WHERE price <= $1;` SelectTicketIDHeightByHash = `SELECT id, block_height FROM tickets WHERE tx_hash = $1 ORDER BY is_mainchain DESC;` SelectTicketIDByHash = `SELECT id FROM tickets WHERE tx_hash = $1 ORDER BY is_mainchain DESC;` SelectTicketStatusByHash = `SELECT id, spend_type, pool_status FROM tickets WHERE tx_hash = $1 ORDER BY is_mainchain DESC;` SelectUnspentTickets = `SELECT id, tx_hash FROM tickets WHERE spend_type = 0 OR spend_type = -1 AND is_mainchain = true;` SelectTicketSpendTypeByBlock = `` /* 204-byte string literal not displayed */ // Update SetTicketSpendingInfoForHash = `` /* 136-byte string literal not displayed */ SetTicketSpendingInfoForTicketDbID = `UPDATE tickets SET spend_type = $4, spend_height = $2, spend_tx_db_id = $3, pool_status = $5 WHERE id = $1;` SetTicketSpendingInfoForTxDbID = `` /* 126-byte string literal not displayed */ SetTicketPoolStatusForTicketDbID = `UPDATE tickets SET pool_status = $2 WHERE id = $1;` SetTicketPoolStatusForHash = `UPDATE tickets SET pool_status = $2 WHERE tx_hash = $1;` UpdateTicketsMainchainAll = `` /* 136-byte string literal not displayed */ UpdateTicketsMainchainByBlock = `UPDATE tickets SET is_mainchain=$1 WHERE block_hash=$2;` // Index IndexTicketsTableOnHashes = `CREATE UNIQUE INDEX uix_ticket_hashes_index ON tickets(tx_hash, block_hash);` DeindexTicketsTableOnHashes = `DROP INDEX uix_ticket_hashes_index;` IndexTicketsTableOnTxDbID = `CREATE UNIQUE INDEX uix_ticket_ticket_db_id ON tickets(purchase_tx_db_id);` DeindexTicketsTableOnTxDbID = `DROP INDEX uix_ticket_ticket_db_id;` DeleteTicketsDuplicateRows = `` /* 185-byte string literal not displayed */ CreateVotesTable = `` /* 338-byte string literal not displayed */ SelectAllVoteDbIDsHeightsTicketHashes = `SELECT id, height, ticket_hash FROM votes;` SelectAllVoteDbIDsHeightsTicketDbIDs = `SELECT id, height, ticket_tx_db_id FROM votes;` UpdateVotesMainchainAll = `` /* 134-byte string literal not displayed */ UpdateVotesMainchainByBlock = `UPDATE votes SET is_mainchain=$1 WHERE block_hash=$2;` // Index IndexVotesTableOnHashes = `CREATE UNIQUE INDEX uix_votes_hashes_index ON votes(tx_hash, block_hash);` DeindexVotesTableOnHashes = `DROP INDEX uix_votes_hashes_index;` IndexVotesTableOnBlockHash = `CREATE INDEX uix_votes_block_hash ON votes(block_hash);` DeindexVotesTableOnBlockHash = `DROP INDEX uix_votes_block_hash;` IndexVotesTableOnCandidate = `CREATE INDEX uix_votes_candidate_block ON votes(candidate_block_hash);` DeindexVotesTableOnCandidate = `DROP INDEX uix_votes_candidate_block;` IndexVotesTableOnVoteVersion = `CREATE INDEX uix_votes_vote_version ON votes(version);` DeindexVotesTableOnVoteVersion = `DROP INDEX uix_votes_vote_version;` DeleteVotesDuplicateRows = `` /* 181-byte string literal not displayed */ CreateMissesTable = `` /* 173-byte string literal not displayed */ SelectMissesInBlock = `SELECT ticket_hash FROM misses WHERE block_hash = $1;` // Index IndexMissesTableOnHashes = `CREATE UNIQUE INDEX uix_misses_hashes_index ON misses(ticket_hash, block_hash);` DeindexMissesTableOnHashes = `DROP INDEX uix_misses_hashes_index;` DeleteMissesDuplicateRows = `` /* 187-byte string literal not displayed */ // Agendas CreateAgendasTable = `` /* 239-byte string literal not displayed */ SelectAgendasAgendaVotesByTime = `` /* 466-byte string literal not displayed */ SelectAgendasAgendaVotesByHeight = `` /* 447-byte string literal not displayed */ SelectAgendasLockedIn = `select block_height from agendas where locked_in = true and agenda_id = $1 limit 1;` SelectAgendasHardForked = `select block_height from agendas where hard_forked = true and agenda_id = $1 limit 1;` SelectAgendasActivated = `select block_height from agendas where activated = true and agenda_id = $1 limit 1;` IndexAgendasTableOnBlockTime = `CREATE INDEX uix_agendas_block_time ON agendas(block_time);` DeindexAgendasTableOnBlockTime = `DROP INDEX uix_agendas_block_time;` IndexAgendasTableOnAgendaID = `CREATE UNIQUE INDEX uix_agendas_agenda_id ON agendas(agenda_id, agenda_vote_choice, tx_hash, block_height);` DeindexAgendasTableOnAgendaID = `DROP INDEX uix_agendas_agenda_id;` )
View Source
const ( CreateTransactionTable = `` /* 453-byte string literal not displayed */ SelectTxByHash = `SELECT id, block_hash, block_index, tree FROM transactions WHERE tx_hash = $1;` SelectTxsByBlockHash = `SELECT id, tx_hash, block_index, tree, block_time FROM transactions WHERE block_hash = $1;` SelectTxBlockTimeByHash = `SELECT block_time FROM transactions where tx_hash = $1 ORDER BY block_time DESC LIMIT 1;` SelectTxIDHeightByHash = `SELECT id, block_height FROM transactions WHERE tx_hash = $1;` SelectTxsPerDay = `SELECT to_timestamp(time)::date as date, count(*) FROM transactions GROUP BY date ORDER BY date;` SelectFullTxByHash = `` /* 259-byte string literal not displayed */ SelectTxnsVinsByBlock = `SELECT vin_db_ids, is_valid, is_mainchain FROM transactions WHERE block_hash = $1;` SelectTxnsVinsVoutsByBlock = `SELECT vin_db_ids, vout_db_ids, is_mainchain FROM transactions WHERE block_hash = $1;` SelectTxsVinsAndVoutsIDs = `SELECT tx_type, vin_db_ids, vout_db_ids FROM transactions WHERE block_height BETWEEN $1 AND $2;` SelectRegularTxnsVinsVoutsByBlock = `SELECT vin_db_ids, vout_db_ids, is_mainchain FROM transactions WHERE block_hash = $1 AND tree = 0;` UpdateRegularTxnsValidMainchainByBlock = `UPDATE transactions SET is_valid=$1, is_mainchain=$2 WHERE block_hash=$3 and tree=0;` UpdateRegularTxnsValidByBlock = `UPDATE transactions SET is_valid=$1 WHERE block_hash=$2 and tree=0;` UpdateTxnsMainchainByBlock = `UPDATE transactions SET is_mainchain=$1 WHERE block_hash=$2 RETURNING id;` UpdateTxnsValidMainchainAll = `` /* 196-byte string literal not displayed */ UpdateRegularTxnsValidAll = `` /* 142-byte string literal not displayed */ UpdateTxnsMainchainAll = `` /* 141-byte string literal not displayed */ SelectRegularTxByHash = `SELECT id, block_hash, block_index FROM transactions WHERE tx_hash = $1 and tree=0;` SelectStakeTxByHash = `SELECT id, block_hash, block_index FROM transactions WHERE tx_hash = $1 and tree=1;` IndexTransactionTableOnBlockIn = `CREATE UNIQUE INDEX uix_tx_block_in ON transactions(block_hash, block_index, tree);` DeindexTransactionTableOnBlockIn = `DROP INDEX uix_tx_block_in;` IndexTransactionTableOnHashes = `CREATE UNIQUE INDEX uix_tx_hashes ON transactions(tx_hash, block_hash);` DeindexTransactionTableOnHashes = `DROP INDEX uix_tx_hashes;` DeleteTxDuplicateRows = `` /* 190-byte string literal not displayed */ RetrieveVoutDbIDs = `SELECT unnest(vout_db_ids) FROM transactions WHERE id = $1;` RetrieveVoutDbID = `SELECT vout_db_ids[$2] FROM transactions WHERE id = $1;` )
View Source
const ( CreateVinTable = `` /* 271-byte string literal not displayed */ InsertVinRow0 = `` /* 200-byte string literal not displayed */ InsertVinRow = InsertVinRow0 + `RETURNING id;` // InsertVinRowChecked = InsertVinRow0 + // `ON CONFLICT (tx_hash, tx_index, tx_tree) DO NOTHING RETURNING id;` UpsertVinRow = InsertVinRow0 + `ON CONFLICT (tx_hash, tx_index, tx_tree) DO UPDATE SET is_valid = $8, is_mainchain = $9, block_time = $10, prev_tx_hash = $4, prev_tx_index = $5, prev_tx_tree = $6 RETURNING id;` DeleteVinsDuplicateRows = `` /* 186-byte string literal not displayed */ IndexVinTableOnVins = `CREATE UNIQUE INDEX uix_vin ON vins(tx_hash, tx_index, tx_tree);` DeindexVinTableOnVins = `DROP INDEX uix_vin;` IndexVinTableOnPrevOuts = `CREATE INDEX uix_vin_prevout ON vins(prev_tx_hash, prev_tx_index);` DeindexVinTableOnPrevOuts = `DROP INDEX uix_vin_prevout;` SelectVinIDsALL = `SELECT id FROM vins;` CountVinsRows = `SELECT reltuples::BIGINT AS estimate FROM pg_class WHERE relname='vins';` SetTxTypeOnVinsByVinIDs = `UPDATE vins SET tx_type=$1 WHERE id=$2;` SelectSpendingTxsByPrevTx = `SELECT id, tx_hash, tx_index, prev_tx_index FROM vins WHERE prev_tx_hash=$1;` SelectSpendingTxsByPrevTxWithBlockHeight = `` /* 285-byte string literal not displayed */ SelectSpendingTxByPrevOut = `SELECT id, tx_hash, tx_index, tx_tree FROM vins WHERE prev_tx_hash=$1 AND prev_tx_index=$2;` SelectFundingTxsByTx = `SELECT id, prev_tx_hash FROM vins WHERE tx_hash=$1;` SelectFundingTxByTxIn = `SELECT id, prev_tx_hash FROM vins WHERE tx_hash=$1 AND tx_index=$2;` SelectFundingOutpointByTxIn = `SELECT id, prev_tx_hash, prev_tx_index, prev_tx_tree FROM vins WHERE tx_hash=$1 AND tx_index=$2;` SelectFundingOutpointByVinID = `SELECT prev_tx_hash, prev_tx_index, prev_tx_tree FROM vins WHERE id=$1;` SelectFundingTxByVinID = `SELECT prev_tx_hash FROM vins WHERE id=$1;` SelectSpendingTxByVinID = `SELECT tx_hash, tx_index, tx_tree FROM vins WHERE id=$1;` SelectAllVinInfoByID = `` /* 158-byte string literal not displayed */ SetIsValidIsMainchainByTxHash = `UPDATE vins SET is_valid = $1, is_mainchain = $2 WHERE tx_hash = $3 AND block_time = $4 AND tx_tree = $5;` SetIsValidIsMainchainByVinID = `UPDATE vins SET is_valid = $2, is_mainchain = $3 WHERE id = $1;` SetIsValidByTxHash = `UPDATE vins SET is_valid = $1 WHERE tx_hash = $2 AND block_time = $3 AND tx_tree = $4;` SetIsValidByVinID = `UPDATE vins SET is_valid = $2 WHERE id = $1;` SetIsMainchainByTxHash = `UPDATE vins SET is_mainchain = $1 WHERE tx_hash = $2 AND block_time = $3 AND tx_tree = $4;` SetIsMainchainByVinID = `UPDATE vins SET is_mainchain = $2 WHERE id = $1;` // SetVinsTableCoinSupplyUpgrade does not set is_mainchain because that upgrade comes after this one SetVinsTableCoinSupplyUpgrade = `UPDATE vins SET is_valid = $1, block_time = $3, value_in = $4 WHERE tx_hash = $5 AND tx_index = $6 AND tx_tree = $7;` // SelectCoinSupply fetches the coin supply as of the latest block, where // sum represents the generated coins for all stakebase and only // stake-validated coinbase transactions. SelectCoinSupply = `` /* 244-byte string literal not displayed */ CreateVinType = `` /* 169-byte string literal not displayed */ CreateVoutTable = `` /* 231-byte string literal not displayed */ DeleteVoutDuplicateRows = `` /* 188-byte string literal not displayed */ SelectAddressByTxHash = `SELECT script_addresses, value FROM vouts WHERE tx_hash = $1 AND tx_index = $2 AND tx_tree = $3;` SelectPkScriptByID = `SELECT version, pkscript FROM vouts WHERE id=$1;` SelectVoutIDByOutpoint = `SELECT id FROM vouts WHERE tx_hash=$1 and tx_index=$2;` SelectVoutByID = `SELECT * FROM vouts WHERE id=$1;` RetrieveVoutValue = `SELECT value FROM vouts WHERE tx_hash=$1 and tx_index=$2;` RetrieveVoutValues = `SELECT value, tx_index, tx_tree FROM vouts WHERE tx_hash=$1;` IndexVoutTableOnTxHashIdx = `CREATE UNIQUE INDEX uix_vout_txhash_ind ON vouts(tx_hash, tx_index, tx_tree);` DeindexVoutTableOnTxHashIdx = `DROP INDEX uix_vout_txhash_ind;` CreateVoutType = `` /* 145-byte string literal not displayed */ )
Variables ¶
View Source
var ( SelectAllRevokes = fmt.Sprintf(`SELECT id, tx_hash, block_height, vin_db_ids[0] `+ `FROM transactions WHERE tx_type = %d;`, stake.TxTypeSSRtx) SelectTicketsOutputCountByAllBlocks = fmt.Sprintf(`SELECT block_height, SUM(CASE WHEN num_vout = 3 THEN 1 ELSE 0 END) as solo, SUM(CASE WHEN num_vout = 5 THEN 1 ELSE 0 END) as pooled FROM transactions WHERE tx_type = %d GROUP BY block_height ORDER BY block_height;`, stake.TxTypeSStx) SelectTicketsOutputCountByTPWindow = fmt.Sprintf(`SELECT floor(block_height/144) as count, SUM(CASE WHEN num_vout = 3 THEN 1 ELSE 0 END) as solo, SUM(CASE WHEN num_vout = 5 THEN 1 ELSE 0 END) as pooled FROM transactions WHERE tx_type = %d GROUP BY count ORDER BY count;`, stake.TxTypeSStx) )
Functions ¶
func MakeMissInsertStatement ¶
func MakeTxInsertStatement ¶
func MakeVinCopyInStatement ¶
func MakeVinCopyInStatement() string
func MakeVinInsertStatement ¶
func MakeVoteInsertStatement ¶
func MakeVoutCopyInStatement ¶
func MakeVoutCopyInStatement() string
func MakeVoutInsertStatement ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.