@@ -24,7 +24,7 @@ import (
24
24
const (
25
25
// DBFilename is the filename within the data directory which contains
26
26
// the macaroon stores.
27
- DBFilename = "accounts.db "
27
+ DBFilename = "accounts.DB "
28
28
29
29
// dbPathPermission is the default permission the account database
30
30
// directory is created with (if it does not exist).
60
60
61
61
// BoltStore wraps the bolt DB that stores all accounts and their balances.
62
62
type BoltStore struct {
63
- db kvdb.Backend
63
+ DB kvdb.Backend
64
64
clock clock.Clock
65
65
}
66
66
@@ -101,7 +101,7 @@ func NewBoltStore(dir, fileName string, clock clock.Clock) (*BoltStore, error) {
101
101
102
102
// Return the DB wrapped in a BoltStore object.
103
103
return & BoltStore {
104
- db : db ,
104
+ DB : db ,
105
105
clock : clock ,
106
106
}, nil
107
107
}
@@ -110,7 +110,7 @@ func NewBoltStore(dir, fileName string, clock clock.Clock) (*BoltStore, error) {
110
110
//
111
111
// NOTE: This is part of the Store interface.
112
112
func (s * BoltStore ) Close () error {
113
- return s .db .Close ()
113
+ return s .DB .Close ()
114
114
}
115
115
116
116
// NewAccount creates a new OffChainBalanceAccount with the given balance and a
@@ -162,7 +162,7 @@ func (s *BoltStore) NewAccount(ctx context.Context, balance lnwire.MilliSatoshi,
162
162
163
163
// Try storing the account in the account database, so we can keep track
164
164
// of its balance.
165
- err := s .db .Update (func (tx walletdb.ReadWriteTx ) error {
165
+ err := s .DB .Update (func (tx walletdb.ReadWriteTx ) error {
166
166
bucket := tx .ReadWriteBucket (accountBucketName )
167
167
if bucket == nil {
168
168
return ErrAccountBucketNotFound
@@ -364,7 +364,7 @@ func (s *BoltStore) DeleteAccountPayment(_ context.Context, id AccountID,
364
364
func (s * BoltStore ) updateAccount (id AccountID ,
365
365
updateFn func (* OffChainBalanceAccount ) error ) error {
366
366
367
- return s .db .Update (func (tx kvdb.RwTx ) error {
367
+ return s .DB .Update (func (tx kvdb.RwTx ) error {
368
368
bucket := tx .ReadWriteBucket (accountBucketName )
369
369
if bucket == nil {
370
370
return ErrAccountBucketNotFound
@@ -451,7 +451,7 @@ func (s *BoltStore) Account(_ context.Context, id AccountID) (
451
451
// Try looking up and reading the account by its ID from the local
452
452
// bolt DB.
453
453
var accountBinary []byte
454
- err := s .db .View (func (tx kvdb.RTx ) error {
454
+ err := s .DB .View (func (tx kvdb.RTx ) error {
455
455
bucket := tx .ReadBucket (accountBucketName )
456
456
if bucket == nil {
457
457
return ErrAccountBucketNotFound
@@ -487,7 +487,7 @@ func (s *BoltStore) Accounts(_ context.Context) ([]*OffChainBalanceAccount,
487
487
error ) {
488
488
489
489
var accounts []* OffChainBalanceAccount
490
- err := s .db .View (func (tx kvdb.RTx ) error {
490
+ err := s .DB .View (func (tx kvdb.RTx ) error {
491
491
// This function will be called in the ForEach and receive
492
492
// the key and value of each account in the DB. The key, which
493
493
// is also the ID is not used because it is also marshaled into
@@ -531,7 +531,7 @@ func (s *BoltStore) Accounts(_ context.Context) ([]*OffChainBalanceAccount,
531
531
//
532
532
// NOTE: This is part of the Store interface.
533
533
func (s * BoltStore ) RemoveAccount (_ context.Context , id AccountID ) error {
534
- return s .db .Update (func (tx kvdb.RwTx ) error {
534
+ return s .DB .Update (func (tx kvdb.RwTx ) error {
535
535
bucket := tx .ReadWriteBucket (accountBucketName )
536
536
if bucket == nil {
537
537
return ErrAccountBucketNotFound
@@ -554,7 +554,7 @@ func (s *BoltStore) LastIndexes(_ context.Context) (uint64, uint64, error) {
554
554
var (
555
555
addValue , settleValue []byte
556
556
)
557
- err := s .db .View (func (tx kvdb.RTx ) error {
557
+ err := s .DB .View (func (tx kvdb.RTx ) error {
558
558
bucket := tx .ReadBucket (accountBucketName )
559
559
if bucket == nil {
560
560
return ErrAccountBucketNotFound
@@ -592,7 +592,7 @@ func (s *BoltStore) StoreLastIndexes(_ context.Context, addIndex,
592
592
byteOrder .PutUint64 (addValue , addIndex )
593
593
byteOrder .PutUint64 (settleValue , settleIndex )
594
594
595
- return s .db .Update (func (tx kvdb.RwTx ) error {
595
+ return s .DB .Update (func (tx kvdb.RwTx ) error {
596
596
bucket := tx .ReadWriteBucket (accountBucketName )
597
597
if bucket == nil {
598
598
return ErrAccountBucketNotFound
0 commit comments