Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addrv2: rust-bitcoin returns invalid torv2 address #50

Open
brunoerg opened this issue Jun 26, 2024 · 3 comments
Open

addrv2: rust-bitcoin returns invalid torv2 address #50

brunoerg opened this issue Jun 26, 2024 · 3 comments

Comments

@brunoerg
Copy link
Owner

brunoerg commented Jun 26, 2024

I just got a crash in addrv2 (#48) target because when deserializing addrv2 addresses rust-bitcoin checks whether TorV2 address is valid and throws an error if it is invalid. However, when deserializing an addrv2, Bitcoin Core doesn't validate TorV2 anymore (Core removed support for torv2 - bitcoin/bitcoin#22050) and simply ignore it. So, the message is valid but the addr is ignored.

3 => {
    if len != 10 {
        return Err(encode::Error::ParseFailed("Invalid TorV2 address"));
    }
    let id = Decodable::consensus_decode(r)?;
    AddrV2::TorV2(id)
}

However, it might be an issue in Bitcoin Core, because even not supporting torv2, it should validate the length according to the BIP.

@brunoerg
Copy link
Owner Author

brunoerg commented Jun 26, 2024

@apoelstra
Copy link

I'd consider this an upstream issue. Though for us, maybe we should drop TorV2 support.

@brunoerg
Copy link
Owner Author

brunoerg commented Jun 27, 2024

Sounds good to drop TorV2 support, it's basically useless.

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

No branches or pull requests

2 participants