mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Surprisingly easy to do. Almost all of the diff resolution was mechanically
* replacing boost::variant with std::variant
* replacing Optional with std::optional
* then replacing `nullopt` with `std::nullopt`
* updating the RPC functions for the new RPCArg::Default type
* update the tests/ directory to make new (since 22) tests use arrays for
createrawtransaction outputs
* other ad-hoc changes to function parameters etc (not too many of these)
I had to "really" change the code in PrecomputePSBTData, which was introduced
in 22.0 and affected by PSET, but this function was like 8 lines long so it
was easy.
Reviewing the diff may be a bit difficult because of the mix of mechanical
changes and ad-hoc things. Probably the most straightforward thing to do
is to redo the merge, `sed -i` to fix the boost::variant and Optional stuff,
then diff the remaining conflicts against this commit.
TODO: grep for `blindpsbt` and you will see that this RPC is still referenced
in documentation and help text even though it was deleted. Need to fix this
in 0.21 in a separate PR.
49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
// Copyright (c) 2019-2020 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_SCRIPT_KEYORIGIN_H
|
|
#define BITCOIN_SCRIPT_KEYORIGIN_H
|
|
|
|
#include <serialize.h>
|
|
#include <vector>
|
|
|
|
struct KeyOriginInfo
|
|
{
|
|
unsigned char fingerprint[4]; //!< First 32 bits of the Hash160 of the public key at the root of the path
|
|
std::vector<uint32_t> path;
|
|
|
|
friend bool operator==(const KeyOriginInfo& a, const KeyOriginInfo& b)
|
|
{
|
|
return std::equal(std::begin(a.fingerprint), std::end(a.fingerprint), std::begin(b.fingerprint)) && a.path == b.path;
|
|
}
|
|
|
|
friend bool operator<(const KeyOriginInfo& a, const KeyOriginInfo& b)
|
|
{
|
|
// Compare the fingerprints lexicographically
|
|
int fpr_cmp = memcmp(a.fingerprint, b.fingerprint, 4);
|
|
if (fpr_cmp < 0) {
|
|
return true;
|
|
} else if (fpr_cmp > 0) {
|
|
return false;
|
|
}
|
|
// Compare the sizes of the paths, shorter is "less than"
|
|
if (a.path.size() < b.path.size()) {
|
|
return true;
|
|
} else if (a.path.size() > b.path.size()) {
|
|
return false;
|
|
}
|
|
// Paths same length, compare them lexicographically
|
|
return a.path < b.path;
|
|
}
|
|
|
|
SERIALIZE_METHODS(KeyOriginInfo, obj) { READWRITE(obj.fingerprint, obj.path); }
|
|
|
|
void clear()
|
|
{
|
|
memset(fingerprint, 0, 4);
|
|
path.clear();
|
|
}
|
|
};
|
|
|
|
#endif // BITCOIN_SCRIPT_KEYORIGIN_H
|