diff --git a/explorer/events.go b/explorer/events.go index 5d3f9aae..2ae7232e 100644 --- a/explorer/events.go +++ b/explorer/events.go @@ -146,19 +146,19 @@ func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate) []Event { fces := make(map[types.FileContractID]types.FileContractElement) v2fces := make(map[types.FileContractID]types.V2FileContractElement) cu.ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool) { - sce.MerkleProof = nil + sce.StateElement.MerkleProof = nil sces[types.SiacoinOutputID(sce.ID)] = sce }) cu.ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool) { - sfe.MerkleProof = nil + sfe.StateElement.MerkleProof = nil sfes[types.SiafundOutputID(sfe.ID)] = sfe }) cu.ForEachFileContractElement(func(fce types.FileContractElement, created bool, rev *types.FileContractElement, resolved, valid bool) { - fce.MerkleProof = nil + fce.StateElement.MerkleProof = nil fces[types.FileContractID(fce.ID)] = fce }) cu.ForEachV2FileContractElement(func(fce types.V2FileContractElement, created bool, rev *types.V2FileContractElement, res types.V2FileContractResolutionType) { - fce.MerkleProof = nil + fce.StateElement.MerkleProof = nil v2fces[types.FileContractID(fce.ID)] = fce }) @@ -220,7 +220,7 @@ func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate) []Event { var e EventV2Transaction for _, a := range txn.Attestations { var ha chain.HostAnnouncement - if ha.FromAttestation(a) { + if ha.FromArbitraryData(a.Value) { e.HostAnnouncements = append(e.HostAnnouncements, ha) } } diff --git a/explorer/update.go b/explorer/update.go index f5447503..9e31d222 100644 --- a/explorer/update.go +++ b/explorer/update.go @@ -91,7 +91,7 @@ func applyChainUpdate(tx UpdateTx, cau chain.ApplyUpdate) error { if created && spent { ephemeralSiacoinElements = append(ephemeralSiacoinElements, SiacoinOutput{ SiacoinElement: se, - Source: sources[types.SiacoinOutputID(se.StateElement.ID)], + Source: sources[types.SiacoinOutputID(se.ID)], }) return } @@ -99,12 +99,12 @@ func applyChainUpdate(tx UpdateTx, cau chain.ApplyUpdate) error { if spent { spentSiacoinElements = append(spentSiacoinElements, SiacoinOutput{ SiacoinElement: se, - Source: sources[types.SiacoinOutputID(se.StateElement.ID)], + Source: sources[types.SiacoinOutputID(se.ID)], }) } else { newSiacoinElements = append(newSiacoinElements, SiacoinOutput{ SiacoinElement: se, - Source: sources[types.SiacoinOutputID(se.StateElement.ID)], + Source: sources[types.SiacoinOutputID(se.ID)], }) } }) diff --git a/persist/sqlite/addresses.go b/persist/sqlite/addresses.go index 296adb44..dbda4f6f 100644 --- a/persist/sqlite/addresses.go +++ b/persist/sqlite/addresses.go @@ -69,14 +69,14 @@ func scanEvent(tx *txn, s scanner) (ev explorer.Event, eventID int64, err error) FROM contract_payout_events ev JOIN siacoin_elements sce ON ev.output_id = sce.id JOIN file_contract_elements fce ON ev.contract_id = fce.id -WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), &m.SiacoinOutput.MaturityHeight, decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value), decode(&m.FileContract.StateElement.ID), decode(&m.FileContract.StateElement.LeafIndex), decode(&m.FileContract.FileContract.Filesize), decode(&m.FileContract.FileContract.FileMerkleRoot), decode(&m.FileContract.FileContract.WindowStart), decode(&m.FileContract.FileContract.WindowEnd), decode(&m.FileContract.FileContract.Payout), decode(&m.FileContract.FileContract.UnlockHash), decode(&m.FileContract.FileContract.RevisionNumber), &m.Missed) +WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), &m.SiacoinOutput.MaturityHeight, decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value), decode(&m.FileContract.ID), decode(&m.FileContract.StateElement.LeafIndex), decode(&m.FileContract.FileContract.Filesize), decode(&m.FileContract.FileContract.FileMerkleRoot), decode(&m.FileContract.FileContract.WindowStart), decode(&m.FileContract.FileContract.WindowEnd), decode(&m.FileContract.FileContract.Payout), decode(&m.FileContract.FileContract.UnlockHash), decode(&m.FileContract.FileContract.RevisionNumber), &m.Missed) ev.Data = &m case explorer.EventTypeMinerPayout: var m explorer.EventMinerPayout err = tx.QueryRow(`SELECT sc.output_id, sc.leaf_index, sc.maturity_height, sc.address, sc.value FROM siacoin_elements sc INNER JOIN miner_payout_events ev ON (ev.output_id = sc.id) -WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value)) +WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value)) if err != nil { return explorer.Event{}, 0, fmt.Errorf("failed to fetch miner payout event data: %w", err) } @@ -86,7 +86,7 @@ WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), err = tx.QueryRow(`SELECT sc.output_id, sc.leaf_index, sc.maturity_height, sc.address, sc.value FROM siacoin_elements sc INNER JOIN foundation_subsidy_events ev ON (ev.output_id = sc.id) -WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value)) +WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value)) ev.Data = &m default: return explorer.Event{}, 0, fmt.Errorf("unknown event type: %s", eventType) @@ -180,7 +180,7 @@ func (s *Store) AddressEvents(address types.Address, offset, limit uint64) (even func scanSiacoinOutput(s scanner) (sco explorer.SiacoinOutput, err error) { var spentIndex types.ChainIndex - err = s.Scan(decode(&sco.StateElement.ID), decode(&sco.StateElement.LeafIndex), &sco.Source, decodeNull(&spentIndex), &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value)) + err = s.Scan(decode(&sco.ID), decode(&sco.StateElement.LeafIndex), &sco.Source, decodeNull(&spentIndex), &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value)) if spentIndex != (types.ChainIndex{}) { sco.SpentIndex = &spentIndex } @@ -189,7 +189,7 @@ func scanSiacoinOutput(s scanner) (sco explorer.SiacoinOutput, err error) { func scanSiafundOutput(s scanner) (sfo explorer.SiafundOutput, err error) { var spentIndex types.ChainIndex - err = s.Scan(decode(&sfo.StateElement.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value)) + err = s.Scan(decode(&sfo.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value)) if spentIndex != (types.ChainIndex{}) { sfo.SpentIndex = &spentIndex } diff --git a/persist/sqlite/consensus.go b/persist/sqlite/consensus.go index bd3e0971..bf8b4ff9 100644 --- a/persist/sqlite/consensus.go +++ b/persist/sqlite/consensus.go @@ -507,7 +507,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme defer stmt.Close() for _, sce := range newElements { - result, err := stmt.Exec(encode(sce.StateElement.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(sce.StateElement.LeafIndex)) + result, err := stmt.Exec(encode(sce.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(sce.StateElement.LeafIndex)) if err != nil { return nil, fmt.Errorf("addSiacoinElements: failed to execute siacoin_elements statement: %w", err) } @@ -517,7 +517,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme return nil, fmt.Errorf("addSiacoinElements: failed to get last insert ID: %w", err) } - scDBIds[types.SiacoinOutputID(sce.StateElement.ID)] = dbID + scDBIds[types.SiacoinOutputID(sce.ID)] = dbID } } if len(spentElements) > 0 { @@ -531,7 +531,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme defer stmt.Close() for _, sce := range spentElements { - result, err := stmt.Exec(encode(sce.StateElement.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), encode(index), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(index), encode(sce.StateElement.LeafIndex)) + result, err := stmt.Exec(encode(sce.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), encode(index), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(index), encode(sce.StateElement.LeafIndex)) if err != nil { return nil, fmt.Errorf("addSiacoinElements: failed to execute siacoin_elements statement: %w", err) } @@ -541,7 +541,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme return nil, fmt.Errorf("addSiacoinElements: failed to get last insert ID: %w", err) } - scDBIds[types.SiacoinOutputID(sce.StateElement.ID)] = dbID + scDBIds[types.SiacoinOutputID(sce.ID)] = dbID } } @@ -561,7 +561,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme defer stmt.Close() for _, sfe := range newElements { - result, err := stmt.Exec(encode(sfe.StateElement.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex)) + result, err := stmt.Exec(encode(sfe.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex)) if err != nil { return nil, fmt.Errorf("addSiafundElements: failed to execute siafund_elements statement: %w", err) } @@ -571,7 +571,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme return nil, fmt.Errorf("addSiafundElements: failed to get last insert ID: %w", err) } - sfDBIds[types.SiafundOutputID(sfe.StateElement.ID)] = dbID + sfDBIds[types.SiafundOutputID(sfe.ID)] = dbID } } if len(spentElements) > 0 { @@ -585,7 +585,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme defer stmt.Close() for _, sfe := range spentElements { - result, err := stmt.Exec(encode(sfe.StateElement.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(index), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex), encode(index)) + result, err := stmt.Exec(encode(sfe.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(index), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex), encode(index)) if err != nil { return nil, fmt.Errorf("addSiafundElements: failed to execute siafund_elements statement: %w", err) } @@ -595,7 +595,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme return nil, fmt.Errorf("addSiafundElements: failed to get last insert ID: %w", err) } - sfDBIds[types.SiafundOutputID(sfe.StateElement.ID)] = dbID + sfDBIds[types.SiafundOutputID(sfe.ID)] = dbID } } return sfDBIds, nil @@ -732,7 +732,7 @@ func addEvents(tx *txn, scDBIds map[types.SiacoinOutputID]int64, fcDBIds map[exp case *explorer.EventMinerPayout: _, err = minerPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(event.ID)]) case *explorer.EventContractPayout: - _, err = contractPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(v.SiacoinOutput.StateElement.ID)], fcDBIds[explorer.DBFileContract{ID: types.FileContractID(v.FileContract.StateElement.ID), RevisionNumber: v.FileContract.FileContract.RevisionNumber}], v.Missed) + _, err = contractPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(v.SiacoinOutput.ID)], fcDBIds[explorer.DBFileContract{ID: types.FileContractID(v.FileContract.ID), RevisionNumber: v.FileContract.FileContract.RevisionNumber}], v.Missed) case *explorer.EventFoundationSubsidy: _, err = foundationSubsidyEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(event.ID)]) default: @@ -917,7 +917,7 @@ func updateFileContractElements(tx *txn, revert bool, b types.Block, fces []expl } if err := addFC( - types.FileContractID(fce.StateElement.ID), + types.FileContractID(fce.ID), fce.StateElement.LeafIndex, fce.FileContract, update.Resolved, diff --git a/persist/sqlite/consensus_test.go b/persist/sqlite/consensus_test.go index 30c4555c..9ce4d927 100644 --- a/persist/sqlite/consensus_test.go +++ b/persist/sqlite/consensus_test.go @@ -379,7 +379,7 @@ func TestSendTransactions(t *testing.T) { } testutil.SignTransaction(cm.TipState(), pk1, &parentTxn) - scOutputID = types.Hash256(parentTxn.SiacoinOutputID(2)) + scOutputID = types.SiacoinOutputID(parentTxn.SiacoinOutputID(2)) sfOutputID = parentTxn.SiafundOutputID(2) // Mine a block with the above transaction @@ -1438,7 +1438,7 @@ func TestRevertSendTransactions(t *testing.T) { } testutil.SignTransaction(cm.TipState(), pk1, &parentTxn) - scOutputID = types.Hash256(parentTxn.SiacoinOutputID(2)) + scOutputID = types.SiacoinOutputID(parentTxn.SiacoinOutputID(2)) sfOutputID = parentTxn.SiafundOutputID(2) // Mine a block with the above transaction diff --git a/persist/sqlite/contracts.go b/persist/sqlite/contracts.go index 2a487c1e..89a82096 100644 --- a/persist/sqlite/contracts.go +++ b/persist/sqlite/contracts.go @@ -18,7 +18,7 @@ func encodedIDs(ids []types.FileContractID) []any { func scanFileContract(s scanner) (contractID int64, fc explorer.FileContract, err error) { var confirmationIndex, proofIndex types.ChainIndex var confirmationTransactionID, proofTransactionID types.TransactionID - err = s.Scan(&contractID, decode(&fc.StateElement.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber)) + err = s.Scan(&contractID, decode(&fc.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber)) if confirmationIndex != (types.ChainIndex{}) { fc.ConfirmationIndex = &confirmationIndex diff --git a/persist/sqlite/transactions.go b/persist/sqlite/transactions.go index 412ed41c..683d8d32 100644 --- a/persist/sqlite/transactions.go +++ b/persist/sqlite/transactions.go @@ -17,7 +17,7 @@ func (s *Store) TransactionChainIndices(txnID types.TransactionID, offset, limit INNER JOIN block_transactions bt ON (bt.block_id = b.id) INNER JOIN transactions t ON (t.id = bt.transaction_id) WHERE t.transaction_id = ? -ORDER BY b.height DESC +ORDER BY b.height DESC LIMIT ? OFFSET ?`, encode(txnID), limit, offset) if err != nil { return err @@ -127,7 +127,7 @@ ORDER BY ts.transaction_order ASC` var txnID int64 var spentIndex types.ChainIndex var sco explorer.SiacoinOutput - if err := rows.Scan(&txnID, decode(&sco.StateElement.ID), decode(&sco.LeafIndex), decodeNull(&spentIndex), &sco.Source, &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value)); err != nil { + if err := rows.Scan(&txnID, decode(&sco.ID), decode(&sco.StateElement.LeafIndex), decodeNull(&spentIndex), &sco.Source, &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value)); err != nil { return nil, fmt.Errorf("failed to scan siacoin output: %w", err) } if spentIndex != (types.ChainIndex{}) { @@ -209,7 +209,7 @@ ORDER BY ts.transaction_order ASC` var txnID int64 var spentIndex types.ChainIndex var sfo explorer.SiafundOutput - if err := rows.Scan(&txnID, decode(&sfo.StateElement.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value)); err != nil { + if err := rows.Scan(&txnID, decode(&sfo.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value)); err != nil { return nil, fmt.Errorf("failed to scan siafund output: %w", err) } if spentIndex != (types.ChainIndex{}) { @@ -305,7 +305,7 @@ ORDER BY ts.transaction_order ASC` var confirmationIndex, proofIndex types.ChainIndex var confirmationTransactionID, proofTransactionID types.TransactionID - if err := rows.Scan(&txnID, &contractID, decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.StateElement.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber)); err != nil { + if err := rows.Scan(&txnID, &contractID, decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber)); err != nil { return nil, fmt.Errorf("failed to scan file contract: %w", err) } @@ -366,7 +366,7 @@ ORDER BY ts.transaction_order ASC` var confirmationIndex, proofIndex types.ChainIndex var confirmationTransactionID, proofTransactionID types.TransactionID - if err := rows.Scan(&txnID, &contractID, decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.ParentID), decode(&fc.UnlockConditions), decode(&fc.StateElement.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decode(&fc.FileContract.FileContract.Filesize), decode(&fc.FileContract.FileContract.FileMerkleRoot), decode(&fc.FileContract.FileContract.WindowStart), decode(&fc.FileContract.FileContract.WindowEnd), decode(&fc.FileContract.FileContract.Payout), decode(&fc.FileContract.FileContract.UnlockHash), decode(&fc.FileContract.FileContract.RevisionNumber)); err != nil { + if err := rows.Scan(&txnID, &contractID, decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.ParentID), decode(&fc.UnlockConditions), decode(&fc.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decode(&fc.FileContract.FileContract.Filesize), decode(&fc.FileContract.FileContract.FileMerkleRoot), decode(&fc.FileContract.FileContract.WindowStart), decode(&fc.FileContract.FileContract.WindowEnd), decode(&fc.FileContract.FileContract.Payout), decode(&fc.FileContract.FileContract.UnlockHash), decode(&fc.FileContract.FileContract.RevisionNumber)); err != nil { return nil, fmt.Errorf("failed to scan file contract: %w", err) } @@ -477,7 +477,7 @@ ORDER BY mp.block_order ASC` for rows.Next() { var spentIndex types.ChainIndex var output explorer.SiacoinOutput - if err := rows.Scan(decode(&output.StateElement.ID), decode(&output.StateElement.LeafIndex), decodeNull(&spentIndex), &output.Source, &output.MaturityHeight, decode(&output.SiacoinOutput.Address), decode(&output.SiacoinOutput.Value)); err != nil { + if err := rows.Scan(decode(&output.ID), decode(&output.StateElement.LeafIndex), decodeNull(&spentIndex), &output.Source, &output.MaturityHeight, decode(&output.SiacoinOutput.Address), decode(&output.SiacoinOutput.Value)); err != nil { return nil, fmt.Errorf("failed to scan miner payout: %w", err) } if spentIndex != (types.ChainIndex{}) {