@@ -44,8 +44,8 @@ func addMinerPayouts(tx *txn, bid types.BlockID, scos []types.SiacoinOutput) err
4444 return nil
4545}
4646
47- func addMinerFees (tx * txn , dbID int64 , txn types.Transaction ) error {
48- if len (txn . MinerFees ) == 0 {
47+ func addMinerFees (tx * txn , dbID int64 , minerFees [] types.Currency ) error {
48+ if len (minerFees ) == 0 {
4949 return nil
5050 }
5151
@@ -55,16 +55,16 @@ func addMinerFees(tx *txn, dbID int64, txn types.Transaction) error {
5555 }
5656 defer stmt .Close ()
5757
58- for i , fee := range txn . MinerFees {
58+ for i , fee := range minerFees {
5959 if _ , err := stmt .Exec (dbID , i , encode (fee )); err != nil {
6060 return fmt .Errorf ("addMinerFees: failed to execute statement: %w" , err )
6161 }
6262 }
6363 return nil
6464}
6565
66- func addArbitraryData (tx * txn , dbID int64 , txn types. Transaction ) error {
67- if len (txn . ArbitraryData ) == 0 {
66+ func addArbitraryData (tx * txn , dbID int64 , arbitraryData [][] byte ) error {
67+ if len (arbitraryData ) == 0 {
6868 return nil
6969 }
7070
@@ -74,16 +74,16 @@ func addArbitraryData(tx *txn, dbID int64, txn types.Transaction) error {
7474 }
7575 defer stmt .Close ()
7676
77- for i , arbitraryData := range txn . ArbitraryData {
78- if _ , err := stmt .Exec (dbID , i , arbitraryData ); err != nil {
77+ for i , arb := range arbitraryData {
78+ if _ , err := stmt .Exec (dbID , i , arb ); err != nil {
7979 return fmt .Errorf ("addArbitraryData: failed to execute statement: %w" , err )
8080 }
8181 }
8282 return nil
8383}
8484
85- func addSignatures (tx * txn , dbID int64 , txn types.Transaction ) error {
86- if len (txn . Signatures ) == 0 {
85+ func addSignatures (tx * txn , dbID int64 , signatures [] types.TransactionSignature ) error {
86+ if len (signatures ) == 0 {
8787 return nil
8888 }
8989
@@ -93,16 +93,16 @@ func addSignatures(tx *txn, dbID int64, txn types.Transaction) error {
9393 }
9494 defer stmt .Close ()
9595
96- for i , sig := range txn . Signatures {
96+ for i , sig := range signatures {
9797 if _ , err := stmt .Exec (dbID , i , encode (sig .ParentID ), sig .PublicKeyIndex , encode (sig .Timelock ), encode (sig .CoveredFields ), sig .Signature ); err != nil {
9898 return fmt .Errorf ("addSignatures: failed to execute statement: %w" , err )
9999 }
100100 }
101101 return nil
102102}
103103
104- func addSiacoinInputs (tx * txn , dbID int64 , txn types.Transaction ) error {
105- if len (txn . SiacoinInputs ) == 0 {
104+ func addSiacoinInputs (tx * txn , dbID int64 , siacoinInputs [] types.SiacoinInput ) error {
105+ if len (siacoinInputs ) == 0 {
106106 return nil
107107 }
108108
@@ -112,7 +112,7 @@ func addSiacoinInputs(tx *txn, dbID int64, txn types.Transaction) error {
112112 }
113113 defer stmt .Close ()
114114
115- for i , sci := range txn . SiacoinInputs {
115+ for i , sci := range siacoinInputs {
116116 if _ , err := stmt .Exec (dbID , i , encode (sci .UnlockConditions ), encode (sci .ParentID )); err != nil {
117117 return fmt .Errorf ("addSiacoinInputs: failed to execute statement: %w" , err )
118118 }
@@ -139,8 +139,8 @@ func addSiacoinOutputs(tx *txn, dbID int64, txn types.Transaction) error {
139139 return nil
140140}
141141
142- func addSiafundInputs (tx * txn , dbID int64 , txn types.Transaction ) error {
143- if len (txn . SiafundInputs ) == 0 {
142+ func addSiafundInputs (tx * txn , dbID int64 , siafundInputs [] types.SiafundInput ) error {
143+ if len (siafundInputs ) == 0 {
144144 return nil
145145 }
146146
@@ -150,7 +150,7 @@ func addSiafundInputs(tx *txn, dbID int64, txn types.Transaction) error {
150150 }
151151 defer stmt .Close ()
152152
153- for i , sfi := range txn . SiafundInputs {
153+ for i , sfi := range siafundInputs {
154154 if _ , err := stmt .Exec (dbID , i , encode (sfi .UnlockConditions ), encode (sfi .ClaimAddress ), encode (sfi .ParentID )); err != nil {
155155 return fmt .Errorf ("addSiafundInputs: failed to execute statement: %w" , err )
156156 }
@@ -197,8 +197,8 @@ func addFileContracts(tx *txn, dbID int64, txn types.Transaction) error {
197197 return nil
198198}
199199
200- func addFileContractRevisions (tx * txn , dbID int64 , txn types.Transaction ) error {
201- if len (txn . FileContractRevisions ) == 0 {
200+ func addFileContractRevisions (tx * txn , dbID int64 , fileContractRevisions [] types.FileContractRevision ) error {
201+ if len (fileContractRevisions ) == 0 {
202202 return nil
203203 }
204204
@@ -208,8 +208,7 @@ func addFileContractRevisions(tx *txn, dbID int64, txn types.Transaction) error
208208 }
209209 defer stmt .Close ()
210210
211- for i := range txn .FileContractRevisions {
212- fcr := & txn .FileContractRevisions [i ]
211+ for i , fcr := range fileContractRevisions {
213212 if _ , err := stmt .Exec (dbID , i , encode (fcr .ParentID ), encode (fcr .UnlockConditions ), encode (fcr .ParentID ), encode (fcr .FileContract .RevisionNumber )); err != nil {
214213 return fmt .Errorf ("addFileContractRevisions: failed to execute statement: %w" , err )
215214 }
@@ -218,8 +217,8 @@ func addFileContractRevisions(tx *txn, dbID int64, txn types.Transaction) error
218217 return nil
219218}
220219
221- func addStorageProofs (tx * txn , dbID int64 , txn types.Transaction ) error {
222- if len (txn . StorageProofs ) == 0 {
220+ func addStorageProofs (tx * txn , dbID int64 , storageProofs [] types.StorageProof ) error {
221+ if len (storageProofs ) == 0 {
223222 return nil
224223 }
225224
@@ -229,7 +228,7 @@ func addStorageProofs(tx *txn, dbID int64, txn types.Transaction) error {
229228 }
230229 defer stmt .Close ()
231230
232- for i , proof := range txn . StorageProofs {
231+ for i , proof := range storageProofs {
233232 if _ , err := stmt .Exec (dbID , i , encode (proof .ParentID ), proof .Leaf [:], encode (proof .Proof )); err != nil {
234233 return fmt .Errorf ("addStorageProofs: failed to execute statement: %w" , err )
235234 }
@@ -325,25 +324,25 @@ func addTransactionFields(tx *txn, txns []types.Transaction, txnExist map[types.
325324 return fmt .Errorf ("failed to scan for transaction ID: %w" , err )
326325 }
327326
328- if err := addMinerFees (tx , dbID , txn ); err != nil {
327+ if err := addMinerFees (tx , dbID , txn . MinerFees ); err != nil {
329328 return fmt .Errorf ("failed to add miner fees: %w" , err )
330- } else if err := addArbitraryData (tx , dbID , txn ); err != nil {
329+ } else if err := addArbitraryData (tx , dbID , txn . ArbitraryData ); err != nil {
331330 return fmt .Errorf ("failed to add arbitrary data: %w" , err )
332- } else if err := addSignatures (tx , dbID , txn ); err != nil {
331+ } else if err := addSignatures (tx , dbID , txn . Signatures ); err != nil {
333332 return fmt .Errorf ("failed to add signatures: %w" , err )
334- } else if err := addSiacoinInputs (tx , dbID , txn ); err != nil {
333+ } else if err := addSiacoinInputs (tx , dbID , txn . SiacoinInputs ); err != nil {
335334 return fmt .Errorf ("failed to add siacoin inputs: %w" , err )
336335 } else if err := addSiacoinOutputs (tx , dbID , txn ); err != nil {
337336 return fmt .Errorf ("failed to add siacoin outputs: %w" , err )
338- } else if err := addSiafundInputs (tx , dbID , txn ); err != nil {
337+ } else if err := addSiafundInputs (tx , dbID , txn . SiafundInputs ); err != nil {
339338 return fmt .Errorf ("failed to add siafund inputs: %w" , err )
340339 } else if err := addSiafundOutputs (tx , dbID , txn ); err != nil {
341340 return fmt .Errorf ("failed to add siafund outputs: %w" , err )
342341 } else if err := addFileContracts (tx , dbID , txn ); err != nil {
343342 return fmt .Errorf ("failed to add file contract: %w" , err )
344- } else if err := addFileContractRevisions (tx , dbID , txn ); err != nil {
343+ } else if err := addFileContractRevisions (tx , dbID , txn . FileContractRevisions ); err != nil {
345344 return fmt .Errorf ("failed to add file contract revisions: %w" , err )
346- } else if err := addStorageProofs (tx , dbID , txn ); err != nil {
345+ } else if err := addStorageProofs (tx , dbID , txn . StorageProofs ); err != nil {
347346 return fmt .Errorf ("failed to add storage proofs: %w" , err )
348347 }
349348 }
0 commit comments