From cc0e2a5e6ee0bab9d9b6b1a473acbc5f7260ad60 Mon Sep 17 00:00:00 2001 From: Christopher Tarry Date: Wed, 16 Oct 2024 12:53:27 -0400 Subject: [PATCH] update tests to check for proof outputs --- persist/sqlite/consensus_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/persist/sqlite/consensus_test.go b/persist/sqlite/consensus_test.go index 485fd494..579b0659 100644 --- a/persist/sqlite/consensus_test.go +++ b/persist/sqlite/consensus_test.go @@ -82,13 +82,15 @@ func CheckChainIndices(t *testing.T, db explorer.Store, txnID types.TransactionI } // CheckFCRevisions checks that the revision numbers for the file contracts match. -func CheckFCRevisions(t *testing.T, confirmationIndex types.ChainIndex, confirmationTransactionID types.TransactionID, revisionNumbers []uint64, fcs []explorer.FileContract) { +func CheckFCRevisions(t *testing.T, confirmationIndex types.ChainIndex, confirmationTransactionID types.TransactionID, valid, missed []types.SiacoinOutput, revisionNumbers []uint64, fcs []explorer.FileContract) { t.Helper() testutil.Equal(t, "number of revisions", len(revisionNumbers), len(fcs)) for i := range revisionNumbers { testutil.Equal(t, "confirmation index", confirmationIndex, *fcs[i].ConfirmationIndex) testutil.Equal(t, "confirmation transaction ID", confirmationTransactionID, *fcs[i].ConfirmationTransactionID) + testutil.Equal(t, "valid proof outputs", valid, fcs[i].FileContract.ValidProofOutputs) + testutil.Equal(t, "missed proof outputs", missed, fcs[i].FileContract.MissedProofOutputs) testutil.Equal(t, "revision number", revisionNumbers[i], fcs[i].FileContract.RevisionNumber) } } @@ -594,7 +596,7 @@ func TestFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0}, dbFCs) } { @@ -677,7 +679,7 @@ func TestFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0, 1}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0, 1}, dbFCs) } { @@ -889,7 +891,7 @@ func TestEphemeralFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0, 1}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0, 1}, dbFCs) } { @@ -971,7 +973,7 @@ func TestEphemeralFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0, 1, 2, 3}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0, 1, 2, 3}, dbFCs) } { @@ -2255,7 +2257,7 @@ func TestMultipleReorgFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0}, dbFCs) } { @@ -2336,7 +2338,7 @@ func TestMultipleReorgFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0, 1}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0, 1}, dbFCs) } { @@ -2395,7 +2397,7 @@ func TestMultipleReorgFileContract(t *testing.T) { if err != nil { t.Fatal(err) } - CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, []uint64{0}, dbFCs) + CheckFCRevisions(t, confirmationIndex, confirmationTransactionID, fc.ValidProofOutputs, fc.MissedProofOutputs, []uint64{0}, dbFCs) } // storage utilization should be back to testutil.ContractFilesize instead of