Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Dec 9, 2024

The height hint for deposit confirmations was previously set to the initiation height of the deposit manager, which does not work in case the manager is restarted before a deposit was confirmed.

@hieblmi hieblmi self-assigned this Dec 9, 2024
@hieblmi hieblmi force-pushed the fix-deposit-detection branch from b5cba1f to d8953be Compare December 9, 2024 13:02
@hieblmi hieblmi force-pushed the fix-deposit-detection branch from d8953be to 7b6e602 Compare December 9, 2024 13:32
// into the store.
CreateStaticAddress(ctx context.Context, addrParams *Parameters) error
CreateStaticAddress(ctx context.Context, addrParams *Parameters,
currentHeight int32) error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a separate argument currentHeight is needed? addrParams has new field InitiationHeight.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed currentHeight and use the InitiationHeight.

@hieblmi hieblmi force-pushed the fix-deposit-detection branch from 7b6e602 to 23cc7ca Compare December 9, 2024 13:42
@hieblmi hieblmi requested review from bhandras and starius December 9, 2024 13:51
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice catch! 🎉

Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🏆

I propose to add a test reproducing the bug being fixed.

ProtocolVersion: version.AddressProtocolVersion(
protocolVersion,
),
InitiationHeight: m.currentHeight,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can currentHeight be uninitialized (0) at this point? IMHO we should either return an error here if currentHeight is 0 (if we are sure that this won't happen) or wait for its initialization (e.g. using a cond var).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I've added a check on entry of NewAddress.

go func() {
err := testContext.manager.Run(ctxb)
require.NoError(t, err)
require.ErrorContains(t, err, "context canceled")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: require.ErrorIs(t, err, context.Canceled)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@hieblmi hieblmi force-pushed the fix-deposit-detection branch from 23cc7ca to b1c19e8 Compare December 9, 2024 15:15
@hieblmi hieblmi merged commit 73c2f22 into lightninglabs:static-addr-staging Dec 9, 2024
4 checks passed
@hieblmi hieblmi deleted the fix-deposit-detection branch December 9, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants