@@ -71,7 +71,7 @@ func newMockService() *mockService {
7171	}
7272}
7373
74- func  (m  * mockService ) CheckBalance (_  AccountID ,
74+ func  (m  * mockService ) CheckBalance (_  context. Context ,  _   AccountID ,
7575	wantBalance  lnwire.MilliSatoshi ) error  {
7676
7777	if  wantBalance  >  m .acctBalanceMsat  {
@@ -81,24 +81,28 @@ func (m *mockService) CheckBalance(_ AccountID,
8181	return  nil 
8282}
8383
84- func  (m  * mockService ) AssociateInvoice (id  AccountID , hash  lntypes.Hash ) error  {
84+ func  (m  * mockService ) AssociateInvoice (_  context.Context , id  AccountID ,
85+ 	hash  lntypes.Hash ) error  {
86+ 
8587	m .trackedInvoices [hash ] =  id 
8688
8789	return  nil 
8890}
8991
90- func  (m  * mockService ) AssociatePayment (id   AccountID ,  paymentHash  lntypes. Hash ,
91- 	amt  lnwire.MilliSatoshi ) error  {
92+ func  (m  * mockService ) AssociatePayment (_  context. Context ,  id   AccountID ,
93+ 	paymentHash  lntypes. Hash ,  amt  lnwire.MilliSatoshi ) error  {
9294
9395	return  nil 
9496}
9597
96- func  (m  * mockService ) PaymentErrored (id  AccountID , hash  lntypes.Hash ) error  {
98+ func  (m  * mockService ) PaymentErrored (_  context.Context , id  AccountID ,
99+ 	hash  lntypes.Hash ) error  {
100+ 
97101	return  nil 
98102}
99103
100- func  (m  * mockService ) TrackPayment (_  AccountID ,  hash  lntypes. Hash ,
101- 	amt  lnwire.MilliSatoshi ) error  {
104+ func  (m  * mockService ) TrackPayment (_  context. Context ,  _   AccountID ,
105+ 	hash  lntypes. Hash ,  amt  lnwire.MilliSatoshi ) error  {
102106
103107	m .trackedPayments [hash ] =  & PaymentEntry {
104108		Status :     lnrpc .Payment_UNKNOWN ,
@@ -108,7 +112,9 @@ func (m *mockService) TrackPayment(_ AccountID, hash lntypes.Hash,
108112	return  nil 
109113}
110114
111- func  (m  * mockService ) RemovePayment (hash  lntypes.Hash ) error  {
115+ func  (m  * mockService ) RemovePayment (_  context.Context ,
116+ 	hash  lntypes.Hash ) error  {
117+ 
112118	delete (m .trackedPayments , hash )
113119
114120	return  nil 
@@ -517,14 +523,15 @@ func testSendPayment(t *testing.T, uri string) {
517523	errFunc  :=  func (err  error ) {
518524		lndMock .mainErrChan  <-  err 
519525	}
520- 	service , err  :=  NewService (t .TempDir (), errFunc )
526+ 	store  :=  NewTestDB (t )
527+ 	service , err  :=  NewService (store , errFunc )
521528	require .NoError (t , err )
522529
523530	err  =  service .Start (ctx , lndMock , routerMock , chainParams )
524531	require .NoError (t , err )
525532
526533	assertBalance  :=  func (id  AccountID , expectedBalance  int64 ) {
527- 		acct , err  :=  service .Account (id )
534+ 		acct , err  :=  service .Account (ctx ,  id )
528535		require .NoError (t , err )
529536
530537		require .Equal (t , expectedBalance ,
@@ -539,7 +546,7 @@ func testSendPayment(t *testing.T, uri string) {
539546
540547	// Create an account and add it to the context. 
541548	acct , err  :=  service .NewAccount (
542- 		5000 , time .Now ().Add (time .Hour ), "test" ,
549+ 		ctx ,  5000 , time .Now ().Add (time .Hour ), "test" ,
543550	)
544551	require .NoError (t , err )
545552
@@ -713,14 +720,15 @@ func TestSendPaymentV2(t *testing.T) {
713720	errFunc  :=  func (err  error ) {
714721		lndMock .mainErrChan  <-  err 
715722	}
716- 	service , err  :=  NewService (t .TempDir (), errFunc )
723+ 	store  :=  NewTestDB (t )
724+ 	service , err  :=  NewService (store , errFunc )
717725	require .NoError (t , err )
718726
719727	err  =  service .Start (ctx , lndMock , routerMock , chainParams )
720728	require .NoError (t , err )
721729
722730	assertBalance  :=  func (id  AccountID , expectedBalance  int64 ) {
723- 		acct , err  :=  service .Account (id )
731+ 		acct , err  :=  service .Account (ctx ,  id )
724732		require .NoError (t , err )
725733
726734		require .Equal (t , expectedBalance ,
@@ -735,7 +743,7 @@ func TestSendPaymentV2(t *testing.T) {
735743
736744	// Create an account and add it to the context. 
737745	acct , err  :=  service .NewAccount (
738- 		5000 , time .Now ().Add (time .Hour ), "test" ,
746+ 		ctx ,  5000 , time .Now ().Add (time .Hour ), "test" ,
739747	)
740748	require .NoError (t , err )
741749
@@ -900,14 +908,15 @@ func TestSendToRouteV2(t *testing.T) {
900908	errFunc  :=  func (err  error ) {
901909		lndMock .mainErrChan  <-  err 
902910	}
903- 	service , err  :=  NewService (t .TempDir (), errFunc )
911+ 	store  :=  NewTestDB (t )
912+ 	service , err  :=  NewService (store , errFunc )
904913	require .NoError (t , err )
905914
906915	err  =  service .Start (ctx , lndMock , routerMock , chainParams )
907916	require .NoError (t , err )
908917
909918	assertBalance  :=  func (id  AccountID , expectedBalance  int64 ) {
910- 		acct , err  :=  service .Account (id )
919+ 		acct , err  :=  service .Account (ctx ,  id )
911920		require .NoError (t , err )
912921
913922		require .Equal (t , expectedBalance ,
@@ -922,7 +931,7 @@ func TestSendToRouteV2(t *testing.T) {
922931
923932	// Create an account and add it to the context. 
924933	acct , err  :=  service .NewAccount (
925- 		5000 , time .Now ().Add (time .Hour ), "test" ,
934+ 		ctx ,  5000 , time .Now ().Add (time .Hour ), "test" ,
926935	)
927936	require .NoError (t , err )
928937
0 commit comments