Skip to content

Commit

Permalink
trunc the hash and query by the short version
Browse files Browse the repository at this point in the history
  • Loading branch information
badgersrus committed May 8, 2024
1 parent 5dd0cd1 commit 2bce6b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/host/storage/hostdb/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ func GetBatchByHeight(db HostDB, height *big.Int) (*common.PublicBatch, error) {

// GetBatchTransactions returns the TransactionListingResponse for a given batch hash
func GetBatchTransactions(db HostDB, batchHash gethcommon.Hash) (*common.TransactionListingResponse, error) {
whereQuery := " WHERE b.full_hash=" + db.GetSQLStatement().Placeholder
return fetchBatchTxs(db.GetSQLDB(), whereQuery, batchHash)
whereQuery := " WHERE b.hash=" + db.GetSQLStatement().Placeholder
return fetchBatchTxs(db.GetSQLDB(), whereQuery, truncTo16(batchHash))
}

func fetchBatchHeader(db *sql.DB, whereQuery string, args ...any) (*common.BatchHeader, error) {
Expand Down Expand Up @@ -490,7 +490,7 @@ func fetchTx(db HostDB, seqNo uint64) ([]common.TxHash, error) {
return transactions, nil
}

func fetchBatchTxs(db *sql.DB, whereQuery string, batchHash gethcommon.Hash) (*common.TransactionListingResponse, error) {
func fetchBatchTxs(db *sql.DB, whereQuery string, batchHash []byte) (*common.TransactionListingResponse, error) {
query := selectBatchTxs + whereQuery
rows, err := db.Query(query, batchHash)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions integration/tenscan/tenscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ func TestTenscan(t *testing.T) {
Item common.ObscuroNetworkInfo `json:"item"`
}

//Timer for running local tests
countdownDuration := 20 * time.Minute
tickDuration := 30 * time.Second

for remaining := countdownDuration; remaining > 0; remaining -= tickDuration {
fmt.Printf("Shutting down in %s...\n", remaining)
time.Sleep(tickDuration)
}

configFetchObj := configFetch{}
err = json.Unmarshal(body, &configFetchObj)
assert.NoError(t, err)
Expand Down

0 comments on commit 2bce6b0

Please sign in to comment.