Skip to content

Address gap limit? #74

Open
Open
@evanlinjin

Description

@evanlinjin

Describe the situation

An undisclosed user of ours ran into an issue where creating multiple unbroadcasted transactions resulted in incrementing the revealed index for the internal keychain too rapidly. Eventually, the gap of unused addresses surpassed the stop_gap set for the spk-based chain source, thus some transactions were not caught by the syncing process.

This is caused by Wallet::create_tx which marks change addresses as used.
https://github.com/bitcoindevkit/bdk/blob/775e4aee3a9ec2d99adb129f7a9367a3a15c7032/crates/wallet/src/wallet/mod.rs#L1460

The correct use of the current API would be to call Wallet::cancel_tx. However, I would argue that this is unwieldy and not immediately apparent.
https://github.com/bitcoindevkit/bdk/blob/775e4aee3a9ec2d99adb129f7a9367a3a15c7032/crates/wallet/src/wallet/mod.rs#L1963

Also, recently another user mentioned trying to implement some sort of address-recycling logic on Discord @ #bdk-users.

What to do

Not sure, let's discuss.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew featureNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions