From 3779ab8e7db5e48a0e74c307703475a596ad4bdb Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Mon, 22 Apr 2024 12:20:34 -0700 Subject: [PATCH] Drop columns and logging that aren't useful --- .../internal/db/migrations/02_transactions.sql | 11 ++++------- cmd/soroban-rpc/internal/db/transaction.go | 13 +++---------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/cmd/soroban-rpc/internal/db/migrations/02_transactions.sql b/cmd/soroban-rpc/internal/db/migrations/02_transactions.sql index 32a2e15e..9b10bc17 100644 --- a/cmd/soroban-rpc/internal/db/migrations/02_transactions.sql +++ b/cmd/soroban-rpc/internal/db/migrations/02_transactions.sql @@ -1,16 +1,13 @@ -- +migrate Up --- index to find transactions in ledgers by hash +-- indexing table to find transactions in ledgers by hash CREATE TABLE transactions ( hash NCHAR(64) PRIMARY KEY, ledger_sequence INTEGER NOT NULL, - application_order INTEGER NOT NULL, - -- possibly a useful search index for Soroban-oriented queries, e.g. - -- transactions that involve the SAC or have just events in general - is_soroban BOOLEAN NOT NULL, - FOREIGN KEY (ledger_sequence) - REFERENCES ledger_close_meta (sequence) + application_order INTEGER NOT NULL ); +CREATE INDEX index_ledger_sequence ON transactions(ledger_sequence); + -- +migrate Down drop table transactions cascade; diff --git a/cmd/soroban-rpc/internal/db/transaction.go b/cmd/soroban-rpc/internal/db/transaction.go index c728b398..2fe4f248 100644 --- a/cmd/soroban-rpc/internal/db/transaction.go +++ b/cmd/soroban-rpc/internal/db/transaction.go @@ -87,10 +87,7 @@ func (txn *transactionHandler) InsertTransactions(lcm xdr.LedgerCloseMeta) error if txn.stmtCache == nil { return errors.New("TransactionWriter incorrectly initialized without stmtCache") - } - - if txCount == 0 { - L.Warnf("No transactions present in ledger: %+v", lcm) + } else if txCount == 0 { return nil } @@ -117,15 +114,11 @@ func (txn *transactionHandler) InsertTransactions(lcm xdr.LedgerCloseMeta) error } mid := time.Now() - L.WithField("passphrase", txn.passphrase). - Debugf("Ingesting %d transaction lookups from ledger", len(transactions)) - query := sq.Insert(transactionTableName). - Columns("hash", "ledger_sequence", "application_order", "is_soroban") + Columns("hash", "ledger_sequence", "application_order") for hash, tx := range transactions { hexHash := hex.EncodeToString(hash[:]) - is_soroban := (tx.UnsafeMeta.V == 3 && tx.UnsafeMeta.V3.SorobanMeta != nil) - query = query.Values(hexHash, lcm.LedgerSequence(), tx.Index, is_soroban) + query = query.Values(hexHash, lcm.LedgerSequence(), tx.Index) } _, err = query.RunWith(txn.stmtCache).Exec()