diff --git a/x/btccheckpoint/keeper/submissions.go b/x/btccheckpoint/keeper/submissions.go index 3ea2cc2b..50f28460 100644 --- a/x/btccheckpoint/keeper/submissions.go +++ b/x/btccheckpoint/keeper/submissions.go @@ -3,9 +3,10 @@ package keeper import ( "context" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "math" + sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" bbn "github.com/babylonlabs-io/babylon/types" "github.com/babylonlabs-io/babylon/x/btccheckpoint/types" @@ -123,11 +124,11 @@ func (k Keeper) checkSubmissionStatus(ctx context.Context, info *types.Submissio subDepth := info.SubmissionDepth() if subDepth >= k.GetParams(ctx).CheckpointFinalizationTimeout { return types.Finalized - } else if subDepth >= k.GetParams(ctx).BtcConfirmationDepth { + } + if subDepth >= k.GetParams(ctx).BtcConfirmationDepth { return types.Confirmed - } else { - return types.Submitted } + return types.Submitted } func (k Keeper) GetSubmissionBtcInfo(ctx context.Context, sk types.SubmissionKey) (*types.SubmissionBtcInfo, error) { diff --git a/x/btccheckpoint/types/btcutils.go b/x/btccheckpoint/types/btcutils.go index 0edeb5d4..17ad852d 100644 --- a/x/btccheckpoint/types/btcutils.go +++ b/x/btccheckpoint/types/btcutils.go @@ -81,11 +81,11 @@ func createBranch(nodes []*chainhash.Hash, numfLeafs uint, idx uint) []*chainhas branch = append(branch, nodes[i+j]) // divide index by 2 as there are two times less nodes on second level - index = index >> 1 + index >>= 1 // after getting node at this level we move to next one by advancing i by // the size of the current level - i = i + size + i += size // update the size to the next level size i.e (current level size / 2) // + 1 is needed to correctly account for cases that the last node of the level