@@ -244,7 +244,7 @@ func TestProcess(t *testing.T) {
244244 // all responses from the database and "write" transactions require a
245245 // lock. While it would be possible to orchestrate these locks in this
246246 // test, it is simpler to just use a "read" transaction.
247- dbTxFail := db .NewDatabaseTransaction (ctx , false )
247+ dbTxFail := db .ReadTransaction (ctx )
248248 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail ).Once ()
249249 jobStorage .On ("Ready" , ctx , dbTxFail ).Return ([]* job.Job {}, nil ).Once ()
250250 jobStorage .On ("Processing" , ctx , dbTxFail , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -261,7 +261,7 @@ func TestProcess(t *testing.T) {
261261 // Determine account must be created
262262 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
263263
264- dbTx := db .NewDatabaseTransaction (ctx , false )
264+ dbTx := db .ReadTransaction (ctx )
265265 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx ).Once ()
266266 jobStorage .On ("Ready" , ctx , dbTx ).Return ([]* job.Job {}, nil ).Once ()
267267 jobStorage .On ("Broadcasting" , ctx , dbTx ).Return ([]* job.Job {}, nil ).Once ()
@@ -292,7 +292,7 @@ func TestProcess(t *testing.T) {
292292
293293 // Attempt to run transfer again (but determine funds are needed)
294294 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
295- dbTxFail2 := db .NewDatabaseTransaction (ctx , false )
295+ dbTxFail2 := db .ReadTransaction (ctx )
296296 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail2 ).Once ()
297297 jobStorage .On ("Ready" , ctx , dbTxFail2 ).Return ([]* job.Job {}, nil ).Once ()
298298 jobStorage .On ("Processing" , ctx , dbTxFail2 , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -323,7 +323,7 @@ func TestProcess(t *testing.T) {
323323 // Attempt funds request
324324 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
325325
326- dbTx2 := db .NewDatabaseTransaction (ctx , false )
326+ dbTx2 := db .ReadTransaction (ctx )
327327 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx2 ).Once ()
328328 jobStorage .On ("Ready" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
329329 jobStorage .On ("Broadcasting" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
@@ -370,7 +370,7 @@ func TestProcess(t *testing.T) {
370370
371371 // Load funds
372372 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
373- dbTxExtra := db .NewDatabaseTransaction (ctx , false )
373+ dbTxExtra := db .ReadTransaction (ctx )
374374 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxExtra ).Once ()
375375 jobStorage .On ("Ready" , ctx , dbTxExtra ).Return ([]* job.Job {& jobExtra }, nil ).Once ()
376376 helper .On ("AllAccounts" , ctx , dbTxExtra ).Return ([]* types.AccountIdentifier {
@@ -403,7 +403,7 @@ func TestProcess(t *testing.T) {
403403
404404 // Attempt to transfer again
405405 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
406- dbTxFail3 := db .NewDatabaseTransaction (ctx , false )
406+ dbTxFail3 := db .ReadTransaction (ctx )
407407 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail3 ).Once ()
408408 jobStorage .On ("Ready" , ctx , dbTxFail3 ).Return ([]* job.Job {}, nil ).Once ()
409409 jobStorage .On ("Processing" , ctx , dbTxFail3 , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -437,7 +437,7 @@ func TestProcess(t *testing.T) {
437437
438438 // Attempt to create recipient
439439 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
440- dbTx3 := db .NewDatabaseTransaction (ctx , false )
440+ dbTx3 := db .ReadTransaction (ctx )
441441 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx3 ).Once ()
442442 jobStorage .On ("Ready" , ctx , dbTx3 ).Return ([]* job.Job {}, nil ).Once ()
443443 jobStorage .On ("Broadcasting" , ctx , dbTx3 ).Return ([]* job.Job {}, nil ).Once ()
@@ -468,7 +468,7 @@ func TestProcess(t *testing.T) {
468468
469469 // Attempt to create transfer
470470 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
471- dbTx4 := db .NewDatabaseTransaction (ctx , false )
471+ dbTx4 := db .ReadTransaction (ctx )
472472 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx4 ).Once ()
473473 jobStorage .On ("Ready" , ctx , dbTx4 ).Return ([]* job.Job {}, nil ).Once ()
474474 jobStorage .On ("Processing" , ctx , dbTx4 , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -676,7 +676,7 @@ func TestProcess(t *testing.T) {
676676
677677 // Wait for transfer to complete
678678 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
679- dbTx5 := db .NewDatabaseTransaction (ctx , false )
679+ dbTx5 := db .ReadTransaction (ctx )
680680 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx5 ).Once ()
681681 jobStorage .On ("Ready" , ctx , dbTx5 ).Return ([]* job.Job {}, nil ).Once ()
682682 jobStorage .On ("Processing" , ctx , dbTx5 , "transfer" ).Return ([]* job.Job {& job4 }, nil ).Once ()
@@ -720,7 +720,7 @@ func TestProcess(t *testing.T) {
720720 }
721721 go func () {
722722 <- markConfirmed
723- dbTx6 := db .NewDatabaseTransaction (ctx , false )
723+ dbTx6 := db .ReadTransaction (ctx )
724724 jobStorage .On ("Get" , ctx , dbTx6 , "job4" ).Return (& job4 , nil ).Once ()
725725 jobStorage .On (
726726 "Update" ,
@@ -745,7 +745,7 @@ func TestProcess(t *testing.T) {
745745 }()
746746
747747 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
748- dbTx7 := db .NewDatabaseTransaction (ctx , false )
748+ dbTx7 := db .ReadTransaction (ctx )
749749 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx7 ).Once ()
750750 jobStorage .On ("Ready" , ctx , dbTx7 ).Return ([]* job.Job {& job4 }, nil ).Once ()
751751 jobStorage .On (
@@ -880,7 +880,7 @@ func TestProcess_Failed(t *testing.T) {
880880
881881 // Attempt to create transfer
882882 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
883- dbTx := db .NewDatabaseTransaction (ctx , false )
883+ dbTx := db .ReadTransaction (ctx )
884884 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx ).Once ()
885885 jobStorage .On ("Ready" , ctx , dbTx ).Return ([]* job.Job {}, nil ).Once ()
886886 jobStorage .On ("Processing" , ctx , dbTx , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -1147,7 +1147,7 @@ func TestProcess_Failed(t *testing.T) {
11471147
11481148 // Wait for transfer to complete
11491149 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
1150- dbTx2 := db .NewDatabaseTransaction (ctx , false )
1150+ dbTx2 := db .ReadTransaction (ctx )
11511151 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx2 ).Once ()
11521152 jobStorage .On ("Ready" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
11531153 jobStorage .On ("Processing" , ctx , dbTx2 , "transfer" ).Return ([]* job.Job {& j }, nil ).Once ()
@@ -1161,7 +1161,7 @@ func TestProcess_Failed(t *testing.T) {
11611161
11621162 go func () {
11631163 <- markConfirmed
1164- dbTx3 := db .NewDatabaseTransaction (ctx , false )
1164+ dbTx3 := db .ReadTransaction (ctx )
11651165 jobStorage .On ("Get" , ctx , dbTx3 , jobIdentifier ).Return (& j , nil ).Once ()
11661166 jobStorage .On (
11671167 "Update" ,
@@ -1398,7 +1398,7 @@ func TestProcess_DryRun(t *testing.T) {
13981398 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
13991399
14001400 // Attempt to transfer
1401- dbTx := db .NewDatabaseTransaction (ctx , false )
1401+ dbTx := db .ReadTransaction (ctx )
14021402 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx ).Once ()
14031403 jobStorage .On ("Ready" , ctx , dbTx ).Return ([]* job.Job {}, nil ).Once ()
14041404 jobStorage .On ("Processing" , ctx , dbTx , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -1509,7 +1509,7 @@ func TestProcess_DryRun(t *testing.T) {
15091509
15101510 // Process second scenario
15111511 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
1512- dbTx2 := db .NewDatabaseTransaction (ctx , false )
1512+ dbTx2 := db .ReadTransaction (ctx )
15131513 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx2 ).Once ()
15141514 jobStorage .On ("Ready" , ctx , dbTx2 ).Return ([]* job.Job {& j }, nil ).Once ()
15151515 jobStorage .On ("Update" , ctx , dbTx2 , mock .Anything ).Run (func (args mock.Arguments ) {
@@ -1683,7 +1683,7 @@ func TestReturnFunds_NoBalance(t *testing.T) {
16831683 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
16841684
16851685 // Attempt to transfer
1686- dbTxFail := db .NewDatabaseTransaction (ctx , false )
1686+ dbTxFail := db .ReadTransaction (ctx )
16871687 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail ).Once ()
16881688 jobStorage .On ("Ready" , ctx , dbTxFail ).Return ([]* job.Job {}, nil ).Once ()
16891689 jobStorage .On (
@@ -1748,7 +1748,7 @@ func TestReturnFunds_NoBalance(t *testing.T) {
17481748
17491749 // Will exit this round because we've tried all workflows.
17501750 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
1751- dbTx2 := db .NewDatabaseTransaction (ctx , false )
1751+ dbTx2 := db .ReadTransaction (ctx )
17521752 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx2 ).Once ()
17531753 jobStorage .On ("Ready" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
17541754 jobStorage .On ("Broadcasting" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
@@ -2015,7 +2015,7 @@ func TestReturnFunds(t *testing.T) {
20152015 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
20162016
20172017 // Attempt to transfer
2018- dbTxFail := db .NewDatabaseTransaction (ctx , false )
2018+ dbTxFail := db .ReadTransaction (ctx )
20192019 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail ).Once ()
20202020 jobStorage .On ("Ready" , ctx , dbTxFail ).Return ([]* job.Job {}, nil ).Once ()
20212021 jobStorage .On (
@@ -2214,7 +2214,7 @@ func TestReturnFunds(t *testing.T) {
22142214
22152215 // Wait for transfer to complete
22162216 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
2217- dbTx := db .NewDatabaseTransaction (ctx , false )
2217+ dbTx := db .ReadTransaction (ctx )
22182218 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx ).Once ()
22192219 jobStorage .On ("Ready" , ctx , dbTx ).Return ([]* job.Job {}, nil ).Once ()
22202220 jobStorage .On (
@@ -2266,7 +2266,7 @@ func TestReturnFunds(t *testing.T) {
22662266 }
22672267 go func () {
22682268 <- markConfirmed
2269- dbTx2 := db .NewDatabaseTransaction (ctx , false )
2269+ dbTx2 := db .ReadTransaction (ctx )
22702270 jobStorage .On ("Get" , ctx , dbTx2 , jobIdentifier ).Return (& j , nil ).Once ()
22712271 jobStorage .On (
22722272 "Update" ,
@@ -2291,7 +2291,7 @@ func TestReturnFunds(t *testing.T) {
22912291
22922292 // No balance remaining
22932293 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
2294- dbTx3 := db .NewDatabaseTransaction (ctx , false )
2294+ dbTx3 := db .ReadTransaction (ctx )
22952295 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx3 ).Once ()
22962296 jobStorage .On ("Ready" , ctx , dbTx3 ).Return ([]* job.Job {}, nil ).Once ()
22972297 jobStorage .On (
@@ -2329,7 +2329,7 @@ func TestReturnFunds(t *testing.T) {
23292329
23302330 // Will exit this round because we've tried all workflows.
23312331 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
2332- dbTx4 := db .NewDatabaseTransaction (ctx , false )
2332+ dbTx4 := db .ReadTransaction (ctx )
23332333 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx4 ).Once ()
23342334 jobStorage .On ("Ready" , ctx , dbTx4 ).Return ([]* job.Job {}, nil ).Once ()
23352335 jobStorage .On ("Broadcasting" , ctx , dbTx4 ).Return ([]* job.Job {}, nil ).Once ()
@@ -2444,7 +2444,7 @@ func TestNoReservedWorkflows(t *testing.T) {
24442444 // all responses from the database and "write" transactions require a
24452445 // lock. While it would be possible to orchestrate these locks in this
24462446 // test, it is simpler to just use a "read" transaction.
2447- dbTxFail := db .NewDatabaseTransaction (ctx , false )
2447+ dbTxFail := db .ReadTransaction (ctx )
24482448 helper .On ("DatabaseTransaction" , ctx ).Return (dbTxFail ).Once ()
24492449 jobStorage .On ("Ready" , ctx , dbTxFail ).Return ([]* job.Job {}, nil ).Once ()
24502450 jobStorage .On ("Processing" , ctx , dbTxFail , "transfer" ).Return ([]* job.Job {}, nil ).Once ()
@@ -2458,7 +2458,7 @@ func TestNoReservedWorkflows(t *testing.T) {
24582458 }()
24592459
24602460 helper .On ("HeadBlockExists" , ctx ).Return (true ).Once ()
2461- dbTx2 := db .NewDatabaseTransaction (ctx , false )
2461+ dbTx2 := db .ReadTransaction (ctx )
24622462 helper .On ("DatabaseTransaction" , ctx ).Return (dbTx2 ).Once ()
24632463 jobStorage .On ("Ready" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
24642464 jobStorage .On ("Broadcasting" , ctx , dbTx2 ).Return ([]* job.Job {}, nil ).Once ()
0 commit comments