Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels work #6

Open
wants to merge 11 commits into
base: implement-bip352-full
Choose a base branch
from
12 changes: 6 additions & 6 deletions src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ SpKey DecodeSpKey(const std::string& str)
auto result = bech32::Decode(str, bech32::CharLimit::SILENT_PAYMENTS);
bool isValid = result.encoding == bech32::Encoding::BECH32M && result.hrp == Params().SilentPaymentKeyHRP(false);
std::vector<unsigned char> data_out = {};
data_out.reserve(BIP352_SPKEY_SIZE);
data_out.reserve(BIP352_SPKEY_SIZE_IN_BYTES);
isValid &= ConvertBits<5, 8, false>([&](unsigned char c) { data_out.push_back(c); }, result.data.begin(), result.data.end());
if (isValid) {
key.Decode(data_out.data());
Expand All @@ -346,10 +346,10 @@ SpKey DecodeSpKey(const std::string& str)

std::string EncodeSpKey(const SpKey& key)
{
std::vector<unsigned char> data(BIP352_SPKEY_SIZE);
std::vector<unsigned char> data(BIP352_SPKEY_SIZE_IN_BYTES);
key.Encode(data.data());
std::vector<unsigned char> data_out = {};
data_out.reserve(((BIP352_SPKEY_SIZE * 8) / 5)+1);
data_out.reserve(((BIP352_SPKEY_SIZE_IN_BYTES * 8) / 5)+1);
ConvertBits<8, 5, true>([&](unsigned char c) { data_out.push_back(c); }, data.begin(), data.end());
auto ret = bech32::Encode(bech32::Encoding::BECH32M, Params().SilentPaymentKeyHRP(false), data_out);
memory_cleanse(data.data(), data.size());
Expand All @@ -364,7 +364,7 @@ SpPubKey DecodeSpPubKey(const std::string& str)
bool isValid = result.encoding == bech32::Encoding::BECH32M &&
result.hrp == Params().SilentPaymentKeyHRP();
std::vector<unsigned char> data_out = {};
data_out.reserve(BIP352_SPKEY_SIZE);
data_out.reserve(BIP352_SPKEY_SIZE_IN_BYTES);
isValid &= ConvertBits<5, 8, false>([&](unsigned char c) { data_out.push_back(c); }, result.data.begin(), result.data.end());
if (isValid) {
key.Decode(data_out.data());
Expand All @@ -374,10 +374,10 @@ SpPubKey DecodeSpPubKey(const std::string& str)

std::string EncodeSpPubKey(const SpPubKey& key)
{
std::vector<unsigned char> data(BIP352_SPKEY_SIZE);
std::vector<unsigned char> data(BIP352_SPKEY_SIZE_IN_BYTES);
key.Encode(data.data());
std::vector<unsigned char> data_out = {};
data_out.reserve(((BIP352_SPKEY_SIZE * 8) / 5)+1);
data_out.reserve(((BIP352_SPKEY_SIZE_IN_BYTES * 8) / 5)+1);
ConvertBits<8, 5, true>([&](unsigned char c) { data_out.push_back(c); }, data.begin(), data.end());
auto ret = bech32::Encode(bech32::Encoding::BECH32M, Params().SilentPaymentKeyHRP(), data_out);
memory_cleanse(data.data(), data.size());
Expand Down
2 changes: 1 addition & 1 deletion src/outputtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy";
static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit";
static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
static const std::string OUTPUT_TYPE_STRING_BECH32M = "bech32m";
static const std::string OUTPUT_TYPE_STRING_SILENT_PAYMENT = "silent-payment";
static const std::string OUTPUT_TYPE_STRING_SILENT_PAYMENT = "silent-payments";
static const std::string OUTPUT_TYPE_STRING_UNKNOWN = "unknown";

std::optional<OutputType> ParseOutputType(const std::string& type)
Expand Down
4 changes: 4 additions & 0 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include <memory>
#include <stdint.h>
#include <variant>

using node::BlockAssembler;
using node::CBlockTemplate;
Expand Down Expand Up @@ -285,6 +286,9 @@ static RPCHelpMan generatetoaddress()
if (!IsValidDestination(destination)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
}
if (std::get_if<V0SilentPaymentDestination>(&destination)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Cannot pay to Silent Payment Output in Coinbase transactions");
}

NodeContext& node = EnsureAnyNodeContext(request.context);
Mining& miner = EnsureMining(node);
Expand Down
5 changes: 4 additions & 1 deletion src/rpc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ class DescribeAddressVisitor

UniValue operator()(const V0SilentPaymentDestination& dest) const
{
return UniValue(UniValue::VOBJ);
UniValue obj(UniValue::VOBJ);
obj.pushKV("isscript", false);
obj.pushKV("iswitness", false);
return obj;
}

UniValue operator()(const PubKeyDestination& dest) const
Expand Down
6 changes: 3 additions & 3 deletions src/script/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class SilentPubkeyProvider final : public PubkeyProvider
public:
SilentPubkeyProvider(uint32_t exp_index, const SpPubKey& sppk) : PubkeyProvider(exp_index), m_sppk(sppk) {}
bool IsRange() const override { return false; }
size_t GetSize() const override { return BIP352_SPKEY_SIZE; }
size_t GetSize() const override { return BIP352_SPKEY_SIZE_IN_BYTES; }
bool GetPubKey(int pos, const SigningProvider& arg, CPubKey& key, KeyOriginInfo& info, const DescriptorCache* read_cache = nullptr, DescriptorCache* write_cache = nullptr) const override
{
return false;
Expand Down Expand Up @@ -610,14 +610,14 @@ class SilentPubkeyProvider final : public PubkeyProvider
if (!arg.GetKey(m_sppk.spendKey.GetID(), spendKey)) return false;
ret.scanKey = m_sppk.scanKey;
ret.spendKey = spendKey;
ret.maximumNumberOfLabels = m_sppk.maximumNumberOfLabels;
ret.fAllowLabels = m_sppk.fAllowLabels;
std::copy(m_sppk.version, m_sppk.version + sizeof(m_sppk.version), ret.version);
std::copy(m_sppk.vchFingerprint, m_sppk.vchFingerprint + sizeof(ret.vchFingerprint), ret.vchFingerprint);
return true;
}
bool GetSpPubKey(SpPubKey& ret) const
{
ret.maximumNumberOfLabels = m_sppk.maximumNumberOfLabels;
ret.fAllowLabels = m_sppk.fAllowLabels;
std::copy(m_sppk.version, m_sppk.version + sizeof(m_sppk.version), ret.version);
std::copy(m_sppk.vchFingerprint, m_sppk.vchFingerprint + sizeof(ret.vchFingerprint), ret.vchFingerprint);
ret.scanKey = m_sppk.scanKey;
Expand Down
42 changes: 21 additions & 21 deletions src/silentpaymentkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,62 @@
#include <silentpaymentkey.h>
#include <span.h>

void SpPubKey::Encode(unsigned char code[BIP352_SPKEY_SIZE]) const
void SpPubKey::Encode(unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]) const
{
// Should probably check that keys are compressed here
memcpy(code, version, 1);
memcpy(code+1, vchFingerprint, 4);
WriteBE32(code+5, maximumNumberOfLabels);
memcpy(code+9, scanKey.begin(), 32);
memcpy(code+41, spendKey.begin(), 33);
memcpy(code+5, &fAllowLabels, 1);
memcpy(code+6, scanKey.begin(), 32);
memcpy(code+38, spendKey.begin(), 33);
}

void SpPubKey::Decode(const unsigned char code[BIP352_SPKEY_SIZE])
void SpPubKey::Decode(const unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES])
{
memcpy(version, code, 1);
memcpy(vchFingerprint, code+1, 4);
maximumNumberOfLabels = ReadBE32(code+5);
scanKey.Set(code+9, code+41, true);
spendKey.Set(code+41, code+BIP352_SPKEY_SIZE);
memcpy(&fAllowLabels, code+5, 1);
scanKey.Set(code+6, code+38, true);
spendKey.Set(code+38, code+BIP352_SPKEY_SIZE_IN_BYTES);
}

CKeyID SpPubKey::GetID() const
{
unsigned char code[BIP352_SPKEY_SIZE];
unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES];
Encode(code);
return CKeyID(Hash160(Span(code, BIP352_SPKEY_SIZE)));
return CKeyID(Hash160(Span(code, BIP352_SPKEY_SIZE_IN_BYTES)));
}

void SpKey::Encode(unsigned char code[BIP352_SPKEY_SIZE]) const
void SpKey::Encode(unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]) const
{
// Should probably check that keys are compressed here
memcpy(code, version, 1);
memcpy(code+1, vchFingerprint, 4);
WriteBE32(code+5, maximumNumberOfLabels);
memcpy(code+9, scanKey.begin(), 32);
code[41] = 0x00;
memcpy(code+42, spendKey.begin(), 32);
memcpy(code+5, &fAllowLabels, 1);
memcpy(code+6, scanKey.begin(), 32);
code[38] = 0x00;
memcpy(code+39, spendKey.begin(), 32);
}

void SpKey::Decode(const unsigned char code[BIP352_SPKEY_SIZE])
void SpKey::Decode(const unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES])
{
if (code[41] != 0x00) {
if (code[38] != 0x00) {
// return early leave SpKey invalid
return;
}
memcpy(version, code, 1);
memcpy(vchFingerprint, code+1, 4);
maximumNumberOfLabels = ReadBE32(code+5);
scanKey.Set(code+9, code+41, true);
spendKey.Set(code+42, code+BIP352_SPKEY_SIZE, true);
memcpy(&fAllowLabels, code+5, 1);
scanKey.Set(code+6, code+38, true);
spendKey.Set(code+39, code+BIP352_SPKEY_SIZE_IN_BYTES, true);
}

SpPubKey SpKey::Neuter()
{
SpPubKey ret;
memcpy(ret.version, version, 1);
memcpy(ret.vchFingerprint, vchFingerprint, 4);
ret.maximumNumberOfLabels = maximumNumberOfLabels;
ret.fAllowLabels = fAllowLabels;
ret.scanKey = scanKey;
ret.spendKey = spendKey.GetPubKey();
return ret;
Expand Down
34 changes: 22 additions & 12 deletions src/silentpaymentkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

#include <cstring>

const unsigned int BIP352_SPKEY_SIZE = 74;
const unsigned int BIP352_SPKEY_SIZE_IN_BYTES = 71;

struct SpPubKey {
unsigned char version[1];
unsigned char vchFingerprint[4];
int maximumNumberOfLabels;
unsigned char fAllowLabels; // sizeof(bool) might differ from 1 based on impl so use "unsigned char"
CKey scanKey;
CPubKey spendKey;

Expand All @@ -29,7 +29,7 @@ struct SpPubKey {
{
memset(version, 0, sizeof(version));
memset(vchFingerprint, 0, sizeof(vchFingerprint));
maximumNumberOfLabels = 0;
fAllowLabels = true;
CPubKey dummySpendPubKey;
spendKey = dummySpendPubKey;
}
Expand All @@ -38,14 +38,14 @@ struct SpPubKey {
{
memset(version, 0, sizeof(version));
memset(vchFingerprint, 0, sizeof(vchFingerprint));
maximumNumberOfLabels = 0;
fAllowLabels = true;
}

friend bool operator==(const SpPubKey &a, const SpPubKey &b)
{
return memcmp(a.version, b.version, sizeof(version)) == 0 &&
memcmp(a.vchFingerprint, b.vchFingerprint, sizeof(vchFingerprint)) == 0 &&
a.maximumNumberOfLabels == b.maximumNumberOfLabels &&
a.fAllowLabels == b.fAllowLabels &&
a.scanKey == b.scanKey &&
a.spendKey == b.spendKey;
}
Expand All @@ -72,8 +72,13 @@ struct SpPubKey {
return scanKey.IsValid() && spendKey.IsValid();
}

void Encode(unsigned char code[BIP352_SPKEY_SIZE]) const;
void Decode(const unsigned char code[BIP352_SPKEY_SIZE]);
bool AllowLabels()
{
return fAllowLabels;
}

void Encode(unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]) const;
void Decode(const unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]);

//! Get the KeyID of this Silent Payment public key (hash of its serialization)
CKeyID GetID() const;
Expand All @@ -82,21 +87,21 @@ struct SpPubKey {
struct SpKey {
unsigned char version[1];
unsigned char vchFingerprint[4];
int maximumNumberOfLabels;
unsigned char fAllowLabels; // sizeof(bool) might differ from 1 based on impl so use "unsigned char"
CKey scanKey;
CKey spendKey;

friend bool operator==(const SpKey& a, const SpKey& b)
{
return memcmp(a.version, b.version, sizeof(version)) == 0 &&
memcmp(a.vchFingerprint, b.vchFingerprint, sizeof(vchFingerprint)) == 0 &&
a.maximumNumberOfLabels == b.maximumNumberOfLabels &&
a.fAllowLabels == b.fAllowLabels &&
a.scanKey == b.scanKey &&
a.spendKey == b.spendKey;
}

SpKey() = default;
SpKey(const SpPubKey& sppub, const CKey& scanKey_in, const CKey& spendKey_in) : maximumNumberOfLabels(sppub.maximumNumberOfLabels), scanKey(scanKey_in), spendKey(spendKey_in)
SpKey(const SpPubKey& sppub, const CKey& scanKey_in, const CKey& spendKey_in) : fAllowLabels(sppub.fAllowLabels), scanKey(scanKey_in), spendKey(spendKey_in)
{
std::copy(sppub.version, sppub.version + sizeof(sppub.version), version);
std::copy(sppub.vchFingerprint, sppub.vchFingerprint + sizeof(sppub.vchFingerprint), vchFingerprint);
Expand All @@ -107,8 +112,13 @@ struct SpKey {
return scanKey.IsValid() && spendKey.IsValid();
}

void Encode(unsigned char code[BIP352_SPKEY_SIZE]) const;
void Decode(const unsigned char code[BIP352_SPKEY_SIZE]);
bool AllowLabels()
{
return fAllowLabels;
}

void Encode(unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]) const;
void Decode(const unsigned char code[BIP352_SPKEY_SIZE_IN_BYTES]);
SpPubKey Neuter();
};

Expand Down
36 changes: 18 additions & 18 deletions src/test/descriptor_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,38 +682,38 @@ BOOST_AUTO_TEST_CASE(descriptor_test)
// Silent Payments
// Check that /* uses default derivation path for SP
CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/*,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/*)",
"sp(spprv1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5qw3uewwg77eaq9rth6er3vj0yutvs5xyup0ndsrg2ffwgheppkkdg3tdld9)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)");
"sp(spprv1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2q8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5ww8yph)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)");

// Check that no path uses default derivation path for SP
CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi)",
"sp(spprv1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5qw3uewwg77eaq9rth6er3vj0yutvs5xyup0ndsrg2ffwgheppkkdg3tdld9)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)");
"sp(spprv1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2q8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5ww8yph)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)");

// Check that provided path is used instead of the default derivation path for SP
CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/0h)",
"sp(spprv1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5qwmvhpf70wwlfxmkfmfm8dargka4qgec2fkmxcpvr3tgkezxs2l6sf4t658)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5p457zxv2j2yzn9ha42hxhf3fkqdz5pc5hykqevp765qrrsdn7vc4skd7hrr)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5p457zxv2j2yzn9ha42hxhf3fkqdz5pc5hykqevp765qrrsdn7vc4skd7hrr)");
"sp(spprv1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2q8dkts5l8h805ndmya5ank735tw6syvu9ymdnvqkpc45tv3rg90ag3njkw0)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2q660prx9f9zpfjm764tnt5c5mqx32qu2tjtqvkqld2qp3cxelxv2ccvc7ax)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2q660prx9f9zpfjm764tnt5c5mqx32qu2tjtqvkqld2qp3cxelxv2ccvc7ax)");

CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi/0h,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi)",
"sp(spprv1qqqqqqqqqqqqqq8dkts5l8h805ndmya5ank735tw6syvu9ymdnvqkpc45tv3rg90agqw3uewwg77eaq9rth6er3vj0yutvs5xyup0ndsrg2ffwgheppkkdgnemptj)",
"sp(sppub1qqqqqqqqqqqqqq8dkts5l8h805ndmya5ank735tw6syvu9ymdnvqkpc45tv3rg90agpnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtss5pst7p)",
"sp(sppub1qqqqqqqqqqqqqq8dkts5l8h805ndmya5ank735tw6syvu9ymdnvqkpc45tv3rg90agpnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtss5pst7p)");
"sp(spprv1qqqqqqqqq8km9c20nmnh6fkajw6wem0g69hdgzxwzjdkekqtqu269kg35zh75q8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5ht3stj)",
"sp(sppub1qqqqqqqqq8km9c20nmnh6fkajw6wem0g69hdgzxwzjdkekqtqu269kg35zh75qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cgufn4lq)",
"sp(sppub1qqqqqqqqq8km9c20nmnh6fkajw6wem0g69hdgzxwzjdkekqtqu269kg35zh75qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cgufn4lq)");

// Check that xpubs are accepted for spend key
CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi,xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5pnngmqzvcpt976aaqlhevn5qkv2y7sk42j0mpd7yzsut507jwgtssknx4ck)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qee5dspxvq4jldw7s0mukf6qtx9z0gt24f8asklzpgw968lf8y9cg9v9p49)",
MISSING_PRIVKEYS);

CheckSilentPayments("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi,xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8/0)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5p8cjcfl7ucts5c4ln7tqfjvm9ledmcpdyq4s55kz6rmssl903az0qr6947z)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5p8cjcfl7ucts5c4ln7tqfjvm9ledmcpdyq4s55kz6rmssl903az0qr6947z)",
"sp(sppub1qqqqqqqqqqqqqq8g7vh8y00v7sz34mav3ckf8jw9kg2rzwqhekcp59y5hytussmtx5p8cjcfl7ucts5c4ln7tqfjvm9ledmcpdyq4s55kz6rmssl903az0qr6947z)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qnufvyllwv9c2v2lel9syexdjlukauqkjq2c22tpdpacg0jhc738sy4ufm5)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qnufvyllwv9c2v2lel9syexdjlukauqkjq2c22tpdpacg0jhc738sy4ufm5)",
"sp(sppub1qqqqqqqqq850xtnj8hk0gpg6a7kgutyne8zmy9p38qtumvq6zj2tj97ggd4n2qnufvyllwv9c2v2lel9syexdjlukauqkjq2c22tpdpacg0jhc738sy4ufm5)",
MISSING_PRIVKEYS);

CheckUnparsable("sp(xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi)",
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class WalletImpl : public Wallet
isminetype is_mine = m_wallet->IsMine(dest);
// In very old wallets, address purpose may not be recorded so we derive it from IsMine
result.emplace_back(dest, is_mine, purpose.value_or(is_mine ? AddressPurpose::RECEIVE : AddressPurpose::SEND), label);
});
}, std::nullopt);
return result;
}
std::vector<std::string> getAddressReceiveRequests() override {
Expand Down
Loading
Loading