diff --git a/db/db.go b/db/db.go index 44042947df..96e79ab798 100644 --- a/db/db.go +++ b/db/db.go @@ -748,7 +748,7 @@ func SaveEpoch(epoch uint64, validators []*types.Validator, client rpc.Client, t attesterslashingscount, attestationscount, depositscount, - withdrawalcount, + COALESCEwithdrawalcount, voluntaryexitscount, validatorscount, averagevalidatorbalance, diff --git a/handlers/api.go b/handlers/api.go index 5d0d164bfd..fe86b6b768 100644 --- a/handlers/api.go +++ b/handlers/api.go @@ -297,7 +297,7 @@ func ApiEpoch(w http.ResponseWriter, r *http.Request) { return } - rows, err := db.ReaderDb.Query(`SELECT attestationscount, attesterslashingscount, averagevalidatorbalance, blockscount, depositscount, eligibleether, epoch, (epoch <= $2) AS finalized, globalparticipationrate, proposerslashingscount, rewards_exported, totalvalidatorbalance, validatorscount, voluntaryexitscount, votedether, withdrawalcount, + rows, err := db.ReaderDb.Query(`SELECT attestationscount, attesterslashingscount, averagevalidatorbalance, blockscount, depositscount, eligibleether, epoch, (epoch <= $2) AS finalized, globalparticipationrate, proposerslashingscount, rewards_exported, totalvalidatorbalance, validatorscount, voluntaryexitscount, votedether, COALESCE(withdrawalcount,0), (SELECT COUNT(*) FROM blocks WHERE epoch = $1 AND status = '0') as scheduledblocks, (SELECT COUNT(*) FROM blocks WHERE epoch = $1 AND status = '1') as proposedblocks, (SELECT COUNT(*) FROM blocks WHERE epoch = $1 AND status = '2') as missedblocks, @@ -355,7 +355,7 @@ func ApiEpochSlots(w http.ResponseWriter, r *http.Request) { return } - rows, err := db.ReaderDb.Query("SELECT attestationscount, attesterslashingscount, blockroot, depositscount, epoch, eth1data_blockhash, eth1data_depositcount, eth1data_depositroot, exec_base_fee_per_gas, exec_block_hash, exec_block_number, exec_extra_data, exec_fee_recipient, exec_gas_limit, exec_gas_used, exec_logs_bloom, exec_parent_hash, exec_random, exec_receipts_root, exec_state_root, exec_timestamp, exec_transactions_count, graffiti, graffiti_text, parentroot, proposer, proposerslashingscount, randaoreveal, signature, slot, stateroot, status, syncaggregate_bits, syncaggregate_participation, syncaggregate_signature, voluntaryexitscount, withdrawalcount FROM blocks WHERE epoch = $1 ORDER BY slot", epoch) + rows, err := db.ReaderDb.Query("SELECT attestationscount, attesterslashingscount, blockroot, depositscount, epoch, eth1data_blockhash, eth1data_depositcount, eth1data_depositroot, exec_base_fee_per_gas, exec_block_hash, exec_block_number, exec_extra_data, exec_fee_recipient, exec_gas_limit, exec_gas_used, exec_logs_bloom, exec_parent_hash, exec_random, exec_receipts_root, exec_state_root, exec_timestamp, COALESCE(exec_transactions_count,0), graffiti, graffiti_text, parentroot, proposer, proposerslashingscount, randaoreveal, signature, slot, stateroot, status, syncaggregate_bits, syncaggregate_participation, syncaggregate_signature, voluntaryexitscount, COALESCE(withdrawalcount,0) FROM blocks WHERE epoch = $1 ORDER BY slot", epoch) if err != nil { sendServerErrorResponse(w, r.URL.String(), "could not retrieve db results") return @@ -434,7 +434,7 @@ func ApiSlots(w http.ResponseWriter, r *http.Request) { blocks.attesterslashingscount, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposer, blocks.status, diff --git a/handlers/epoch.go b/handlers/epoch.go index 2137a901e5..72d76c02cd 100644 --- a/handlers/epoch.go +++ b/handlers/epoch.go @@ -118,7 +118,7 @@ func Epoch(w http.ResponseWriter, r *http.Request) { blocks.parentroot, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposerslashingscount, blocks.attesterslashingscount, diff --git a/handlers/epochs.go b/handlers/epochs.go index ed4143969b..b6a2616837 100644 --- a/handlers/epochs.go +++ b/handlers/epochs.go @@ -85,7 +85,7 @@ func EpochsData(w http.ResponseWriter, r *http.Request) { attesterslashingscount, attestationscount, depositscount, - withdrawalcount, + COALESCE(withdrawalcount,0), voluntaryexitscount, validatorscount, averagevalidatorbalance, diff --git a/handlers/slot.go b/handlers/slot.go index 8a5d2ff110..d19e6f4eb1 100644 --- a/handlers/slot.go +++ b/handlers/slot.go @@ -238,7 +238,7 @@ func GetSlotPageData(blockSlot uint64) (*types.BlockPageData, error) { blocks.attesterslashingscount, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposer, blocks.status, diff --git a/handlers/slots.go b/handlers/slots.go index b5b9e535bc..ccb29b2dff 100644 --- a/handlers/slots.go +++ b/handlers/slots.go @@ -115,7 +115,7 @@ func GetSlotsTableData(draw, start, length uint64, search string, searchForEmpty blocks.parentroot, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposerslashingscount, blocks.attesterslashingscount, @@ -215,7 +215,7 @@ func GetSlotsTableData(draw, start, length uint64, search string, searchForEmpty blocks.parentroot, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposerslashingscount, blocks.attesterslashingscount, diff --git a/handlers/validator.go b/handlers/validator.go index 1ef0bcfd2f..465c66b7b7 100644 --- a/handlers/validator.go +++ b/handlers/validator.go @@ -1061,7 +1061,7 @@ func ValidatorProposedBlocks(w http.ResponseWriter, r *http.Request) { parentroot, attestationscount, depositscount, - withdrawalcount, + COALESCE(withdrawalcount,0), voluntaryexitscount, proposerslashingscount, attesterslashingscount, diff --git a/services/services.go b/services/services.go index d01d791008..722723fb4f 100644 --- a/services/services.go +++ b/services/services.go @@ -817,7 +817,7 @@ func getIndexPageData() (*types.IndexPageData, error) { blocks.parentroot, blocks.attestationscount, blocks.depositscount, - blocks.withdrawalcount, + COALESCE(blocks.withdrawalcount,0), blocks.voluntaryexitscount, blocks.proposerslashingscount, blocks.attesterslashingscount,