Skip to content

Commit

Permalink
Drop columns and logging that aren't useful
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Apr 22, 2024
1 parent 67d5ed9 commit 3779ab8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
11 changes: 4 additions & 7 deletions cmd/soroban-rpc/internal/db/migrations/02_transactions.sql
Original file line number Diff line number Diff line change
@@ -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;
13 changes: 3 additions & 10 deletions cmd/soroban-rpc/internal/db/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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()

Expand Down

0 comments on commit 3779ab8

Please sign in to comment.