Skip to content

Commit

Permalink
include maturity height in /addresses/addr/utxos endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Mar 4, 2024
1 parent 1a34073 commit ac3ede6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions persist/sqlite/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
// UnspentSiacoinOutputs implements explorer.Store.
func (s *Store) UnspentSiacoinOutputs(address types.Address, limit, offset uint64) (result []explorer.SiacoinOutput, err error) {
err = s.transaction(func(tx txn) error {
rows, err := tx.Query(`SELECT output_id, leaf_index, merkle_proof, source, address, value FROM siacoin_elements WHERE address = ? AND spent = 0 LIMIT ? OFFSET ?`, dbEncode(address), limit, offset)
rows, err := tx.Query(`SELECT output_id, leaf_index, merkle_proof, source, maturity_height, address, value FROM siacoin_elements WHERE address = ? AND spent = 0 LIMIT ? OFFSET ?`, dbEncode(address), limit, offset)
if err != nil {
return fmt.Errorf("failed to query siacoin outputs: %w", err)
}
defer rows.Close()

for rows.Next() {
var sco explorer.SiacoinOutput
if err := rows.Scan(dbDecode(&sco.StateElement.ID), dbDecode(&sco.StateElement.LeafIndex), dbDecode(&sco.StateElement.MerkleProof), &sco.Source, dbDecode(&sco.SiacoinOutput.Address), dbDecode(&sco.SiacoinOutput.Value)); err != nil {
if err := rows.Scan(dbDecode(&sco.StateElement.ID), dbDecode(&sco.StateElement.LeafIndex), dbDecode(&sco.StateElement.MerkleProof), &sco.Source, &sco.MaturityHeight, dbDecode(&sco.SiacoinOutput.Address), dbDecode(&sco.SiacoinOutput.Value)); err != nil {
return fmt.Errorf("failed to scan siacoin output: %w", err)
}
result = append(result, sco)
Expand Down

0 comments on commit ac3ede6

Please sign in to comment.