Skip to content

Commit

Permalink
Fixed a warning that was coming up for vector<unsigned char> fill
Browse files Browse the repository at this point in the history
  • Loading branch information
mxaddict committed Jul 31, 2024
1 parent 6c3dec7 commit b412743
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wallet/test/wallet_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,10 @@ static void TestWatchOnlyPubKey(LegacyScriptPubKeyMan* spk_man, const CPubKey& a
// Cryptographically invalidate a PubKey whilst keeping length and first byte
static void PollutePubKey(CPubKey& pubkey)
{
std::vector<unsigned char> pubkey_raw(pubkey.begin(), pubkey.end());
std::fill(pubkey_raw.begin() + 1, pubkey_raw.end(), 0);
assert(pubkey.size() >= 1);
std::vector<unsigned char> pubkey_raw;
pubkey_raw.push_back(pubkey[0]);
pubkey_raw.insert(pubkey_raw.end(), pubkey.size() - 1, 0);
pubkey = CPubKey(pubkey_raw);
assert(!pubkey.IsFullyValid());
assert(pubkey.IsValid());
Expand Down

0 comments on commit b412743

Please sign in to comment.