Skip to content

Commit c4012d0

Browse files
committed
staticaddr: public deposit method scope
1 parent 889d344 commit c4012d0

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

staticaddr/deposit/deposit.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,28 @@ func (d *Deposit) IsInFinalState() bool {
7171
return d.state == Expired || d.state == Failed
7272
}
7373

74-
func (d *Deposit) isExpired(currentHeight, expiry uint32) bool {
74+
func (d *Deposit) IsExpired(currentHeight, expiry uint32) bool {
7575
d.Lock()
7676
defer d.Unlock()
7777

7878
return currentHeight >= uint32(d.ConfirmationHeight)+expiry
7979
}
8080

81-
func (d *Deposit) getState() fsm.StateType {
81+
func (d *Deposit) GetState() fsm.StateType {
8282
d.Lock()
8383
defer d.Unlock()
8484

8585
return d.state
8686
}
8787

88-
func (d *Deposit) setState(state fsm.StateType) {
88+
func (d *Deposit) SetState(state fsm.StateType) {
8989
d.Lock()
9090
defer d.Unlock()
9191

9292
d.state = state
9393
}
9494

95-
func (d *Deposit) isInState(state fsm.StateType) bool {
95+
func (d *Deposit) IsInState(state fsm.StateType) bool {
9696
d.Lock()
9797
defer d.Unlock()
9898

staticaddr/deposit/fsm.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func NewFSM(ctx context.Context, deposit *Deposit, cfg *ManagerConfig,
103103

104104
if recoverStateMachine {
105105
depoFsm.StateMachine = fsm.NewStateMachineWithState(
106-
depositStates, deposit.getState(),
106+
depositStates, deposit.GetState(),
107107
DefaultObserverSize,
108108
)
109109
} else {
@@ -146,8 +146,8 @@ func (f *FSM) handleBlockNotification(currentHeight uint32) error {
146146

147147
// If the deposit is expired but not yet sufficiently confirmed, we
148148
// republish the expiry sweep transaction.
149-
if f.deposit.isExpired(currentHeight, params.Expiry) {
150-
if f.deposit.isInState(WaitForExpirySweep) {
149+
if f.deposit.IsExpired(currentHeight, params.Expiry) {
150+
if f.deposit.IsInState(WaitForExpirySweep) {
151151
f.PublishDepositExpirySweepAction(nil)
152152
} else {
153153
go func() {
@@ -231,13 +231,13 @@ func (f *FSM) updateDeposit(notification fsm.Notification) {
231231
notification.Event,
232232
)
233233

234-
f.deposit.setState(notification.NextState)
234+
f.deposit.SetState(notification.NextState)
235235

236236
// Don't update the deposit if we are in an initial state or if we
237237
// are transitioning from an initial state to a failed state.
238238
d := f.deposit
239-
if d.isInState(fsm.EmptyState) || d.isInState(Deposited) ||
240-
(notification.PreviousState == Deposited && d.isInState(
239+
if d.IsInState(fsm.EmptyState) || d.IsInState(Deposited) ||
240+
(notification.PreviousState == Deposited && d.IsInState(
241241
Failed,
242242
)) {
243243

staticaddr/deposit/sql_store.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (s *SqlStore) CreateDeposit(ctx context.Context, deposit *Deposit) error {
4444
updateArgs := sqlc.InsertDepositUpdateParams{
4545
DepositID: deposit.ID[:],
4646
UpdateTimestamp: s.clock.Now().UTC(),
47-
UpdateState: string(deposit.getState()),
47+
UpdateState: string(deposit.GetState()),
4848
}
4949

5050
return s.baseDB.ExecTx(ctx, &loopdb.SqliteTxOptions{},
@@ -63,7 +63,7 @@ func (s *SqlStore) UpdateDeposit(ctx context.Context, deposit *Deposit) error {
6363
insertUpdateArgs := sqlc.InsertDepositUpdateParams{
6464
DepositID: deposit.ID[:],
6565
UpdateTimestamp: s.clock.Now().UTC(),
66-
UpdateState: string(deposit.getState()),
66+
UpdateState: string(deposit.GetState()),
6767
}
6868

6969
var (

0 commit comments

Comments
 (0)