Skip to content

Commit 56e1e5d

Browse files
committed
refactor, bench, fuzz: Drop unneeded UCharCast calls
The `CKey::Set()` template function handles `std::byte` just fine.
1 parent b5d2118 commit 56e1e5d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/bench/bip324_ecdh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void BIP324_ECDH(benchmark::Bench& bench)
2727

2828
bench.batch(1).unit("ecdh").run([&] {
2929
CKey key;
30-
key.Set(UCharCast(key_data.data()), UCharCast(key_data.data()) + 32, true);
30+
key.Set(key_data.data(), key_data.data() + 32, true);
3131
EllSwiftPubKey our_ellswift(our_ellswift_data);
3232
EllSwiftPubKey their_ellswift(their_ellswift_data);
3333

src/bench/ellswift.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static void EllSwiftCreate(benchmark::Bench& bench)
1717
bench.batch(1).unit("pubkey").run([&] {
1818
auto ret = key.EllSwiftCreate(MakeByteSpan(entropy));
1919
/* Use the first 32 bytes of the ellswift encoded public key as next private key. */
20-
key.Set(UCharCast(ret.data()), UCharCast(ret.data()) + 32, true);
20+
key.Set(ret.data(), ret.data() + 32, true);
2121
assert(key.IsValid());
2222
/* Use the last 32 bytes of the ellswift encoded public key as next entropy. */
2323
std::copy(ret.begin() + 32, ret.begin() + 64, MakeWritableByteSpan(entropy).begin());

src/test/fuzz/util/descriptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void MockedDescriptorConverter::Init() {
1515
// an extended one.
1616
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i) || IdIsXOnlyPubKey(i) || IdIsConstPrivKey(i)) {
1717
CKey privkey;
18-
privkey.Set(UCharCast(key_data.begin()), UCharCast(key_data.end()), !IdIsUnCompPubKey(i));
18+
privkey.Set(key_data.begin(), key_data.end(), !IdIsUnCompPubKey(i));
1919
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i)) {
2020
CPubKey pubkey{privkey.GetPubKey()};
2121
keys_str[i] = HexStr(pubkey);

0 commit comments

Comments
 (0)