@@ -38,7 +38,41 @@ func TestAccountStore(t *testing.T) {
3838 _ , err = store .NewAccount (ctx , 123 , time.Time {}, "0011223344556677" )
3939 require .ErrorContains (t , err , "is not allowed as it can be mistaken" )
4040
41+ now := clock .Now ()
42+
4143 // Update all values of the account that we can modify.
44+ //
45+ // Update the balance and expiry.
46+ err = store .UpdateAccountBalanceAndExpiry (
47+ ctx , acct1 .ID , fn .Some (int64 (- 500 )), fn .Some (now ),
48+ )
49+ require .NoError (t , err )
50+
51+ // Add 2 payments.
52+ _ , err = store .UpsertAccountPayment (
53+ ctx , acct1 .ID , lntypes.Hash {12 , 34 , 56 , 78 }, 123456 ,
54+ lnrpc .Payment_FAILED ,
55+ )
56+ require .NoError (t , err )
57+
58+ _ , err = store .UpsertAccountPayment (
59+ ctx , acct1 .ID , lntypes.Hash {34 , 56 , 78 , 90 }, 789456123789 ,
60+ lnrpc .Payment_SUCCEEDED ,
61+ )
62+ require .NoError (t , err )
63+
64+ // Add 2 invoices.
65+ err = store .AddAccountInvoice (
66+ ctx , acct1 .ID , lntypes.Hash {12 , 34 , 56 , 78 },
67+ )
68+ require .NoError (t , err )
69+ err = store .AddAccountInvoice (
70+ ctx , acct1 .ID , lntypes.Hash {34 , 56 , 78 , 90 },
71+ )
72+ require .NoError (t , err )
73+
74+ // Update the in-memory account so that we can compare it with the
75+ // account we get from the store.
4276 acct1 .CurrentBalance = - 500
4377 acct1 .ExpirationDate = clock .Now ()
4478 acct1 .Payments [lntypes.Hash {12 , 34 , 56 , 78 }] = & PaymentEntry {
@@ -51,8 +85,6 @@ func TestAccountStore(t *testing.T) {
5185 }
5286 acct1 .Invoices [lntypes.Hash {12 , 34 , 56 , 78 }] = struct {}{}
5387 acct1 .Invoices [lntypes.Hash {34 , 56 , 78 , 90 }] = struct {}{}
54- err = store .UpdateAccount (ctx , acct1 )
55- require .NoError (t , err )
5688
5789 dbAccount , err = store .Account (ctx , acct1 .ID )
5890 require .NoError (t , err )
0 commit comments