diff --git a/rust_bitcoin_lib/src/lib.rs b/rust_bitcoin_lib/src/lib.rs index 6f44030..948cfa8 100644 --- a/rust_bitcoin_lib/src/lib.rs +++ b/rust_bitcoin_lib/src/lib.rs @@ -1,21 +1,15 @@ -use std::ffi::CStr; -use std::ffi::CString; -use std::os::raw::c_char; use std::slice; -use std::str::FromStr; -use std::str::Utf8Error; +use std::os::raw::c_char; +use std::ffi::{CStr, CString}; +use std::str::{FromStr, Utf8Error}; -use bitcoin::bip152::PrefilledTransaction; -use bitcoin::bip152::HeaderAndShortIds; -use bitcoin::consensus::deserialize_partial; -use bitcoin::consensus::encode; use bitcoin::Block; -use miniscript::bitcoin::script; +use bitcoin::bip152::{PrefilledTransaction,HeaderAndShortIds}; +use bitcoin::consensus::{deserialize_partial, encode}; + +use miniscript::{Miniscript, Segwitv0, Tap}; +use miniscript::bitcoin::{script, PublicKey}; use miniscript::bitcoin::secp256k1::XOnlyPublicKey; -use miniscript::bitcoin::PublicKey; -use miniscript::Miniscript; -use miniscript::Segwitv0; -use miniscript::Tap; /// Creates a Rust str from a C string. /// diff --git a/targets/addrv2.cpp b/targets/addrv2.cpp index f907356..653b9f1 100644 --- a/targets/addrv2.cpp +++ b/targets/addrv2.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -11,7 +10,7 @@ extern "C" bool rust_bitcoin_addrv2(uint8_t *data, size_t len, uint64_t *count); extern "C" bool go_btcd_addrv2(uint8_t *data, size_t len, uint64_t *count); -std::optional> Core(Span buffer) +std::optional> Addrv2Core(Span buffer) { std::vector addrs; DataStream ds{buffer}; @@ -34,9 +33,9 @@ void Addrv2(FuzzedDataProvider& provider) { std::vector buffer{provider.ConsumeRemainingBytes()}; uint64_t count_rust = 0, count_btcd = 0; - bool rust_bitcoin{rust_bitcoin_addrv2(buffer.data(), buffer.size(), &count_rust)}; - bool btcd{go_btcd_addrv2(buffer.data(), buffer.size(), &count_btcd)}; - auto core{Core(buffer)}; + [[maybe_unused]] bool rust_bitcoin{rust_bitcoin_addrv2(buffer.data(), buffer.size(), &count_rust)}; + [[maybe_unused]] bool btcd{go_btcd_addrv2(buffer.data(), buffer.size(), &count_btcd)}; + auto core{Addrv2Core(buffer)}; if (core.has_value() && core->first > 0) { assert(core->first == count_rust); assert(core->second == count_btcd);