diff options
author | Andrew Chow <github@achow101.com> | 2023-09-05 12:03:46 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-09-12 12:14:31 -0400 |
commit | 8dd067088d41f021b357d7db5fa5f0a9f61edddc (patch) | |
tree | 6b2adb2b5c2e5cae92f032d910e7294d55d716a4 /src/addresstype.cpp | |
parent | 238d29aff9b43234e340a9cf17742b2be5d1e97d (diff) | |
download | bitcoin-8dd067088d41f021b357d7db5fa5f0a9f61edddc.tar.xz |
Make WitnessUnknown members private
Make sure that nothing else can change WitnessUnknown's data members by
making them private. Also change the program to use a vector rather than
C-style array.
Diffstat (limited to 'src/addresstype.cpp')
-rw-r--r-- | src/addresstype.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/addresstype.cpp b/src/addresstype.cpp index 2454cfb5d9..349b50f0c9 100644 --- a/src/addresstype.cpp +++ b/src/addresstype.cpp @@ -87,11 +87,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) return true; } case TxoutType::WITNESS_UNKNOWN: { - WitnessUnknown unk; - unk.version = vSolutions[0][0]; - std::copy(vSolutions[1].begin(), vSolutions[1].end(), unk.program); - unk.length = vSolutions[1].size(); - addressRet = unk; + addressRet = WitnessUnknown{vSolutions[0][0], vSolutions[1]}; return true; } case TxoutType::MULTISIG: @@ -138,7 +134,7 @@ public: CScript operator()(const WitnessUnknown& id) const { - return CScript() << CScript::EncodeOP_N(id.version) << std::vector<unsigned char>(id.program, id.program + id.length); + return CScript() << CScript::EncodeOP_N(id.GetWitnessVersion()) << id.GetWitnessProgram(); } }; } // namespace |