Split key_io (address/key encodings) off from base58

This commit is contained in:
Pieter Wuille 2017-09-19 18:12:25 -07:00
parent ebfe217b15
commit 119b0f85e2
37 changed files with 295 additions and 261 deletions

View file

@ -105,6 +105,7 @@ BITCOIN_CORE_H = \
indirectmap.h \ indirectmap.h \
init.h \ init.h \
key.h \ key.h \
key_io.h \
keystore.h \ keystore.h \
dbwrapper.h \ dbwrapper.h \
limitedmap.h \ limitedmap.h \
@ -327,6 +328,7 @@ libbitcoin_common_a_SOURCES = \
core_read.cpp \ core_read.cpp \
core_write.cpp \ core_write.cpp \
key.cpp \ key.cpp \
key_io.cpp \
keystore.cpp \ keystore.cpp \
netaddress.cpp \ netaddress.cpp \
netbase.cpp \ netbase.cpp \

View file

@ -4,20 +4,12 @@
#include <base58.h> #include <base58.h>
#include <bech32.h>
#include <hash.h> #include <hash.h>
#include <script/script.h>
#include <uint256.h> #include <uint256.h>
#include <utilstrencodings.h>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <algorithm>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
/** All alphanumeric characters except for "0", "I", "O", and "l" */ /** All alphanumeric characters except for "0", "I", "O", and "l" */
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@ -151,209 +143,3 @@ bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRe
{ {
return DecodeBase58Check(str.c_str(), vchRet); return DecodeBase58Check(str.c_str(), vchRet);
} }
namespace
{
class DestinationEncoder : public boost::static_visitor<std::string>
{
private:
const CChainParams& m_params;
public:
DestinationEncoder(const CChainParams& params) : m_params(params) {}
std::string operator()(const CKeyID& id) const
{
std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::PUBKEY_ADDRESS);
data.insert(data.end(), id.begin(), id.end());
return EncodeBase58Check(data);
}
std::string operator()(const CScriptID& id) const
{
std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
data.insert(data.end(), id.begin(), id.end());
return EncodeBase58Check(data);
}
std::string operator()(const WitnessV0KeyHash& id) const
{
std::vector<unsigned char> data = {0};
ConvertBits<8, 5, true>(data, id.begin(), id.end());
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const WitnessV0ScriptHash& id) const
{
std::vector<unsigned char> data = {0};
ConvertBits<8, 5, true>(data, id.begin(), id.end());
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const WitnessUnknown& id) const
{
if (id.version < 1 || id.version > 16 || id.length < 2 || id.length > 40) {
return {};
}
std::vector<unsigned char> data = {(unsigned char)id.version};
ConvertBits<8, 5, true>(data, id.program, id.program + id.length);
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const CNoDestination& no) const { return {}; }
};
CTxDestination DecodeDestination(const std::string& str, const CChainParams& params)
{
std::vector<unsigned char> data;
uint160 hash;
if (DecodeBase58Check(str, data)) {
// base58-encoded Bitcoin addresses.
// Public-key-hash-addresses have version 0 (or 111 testnet).
// The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
const std::vector<unsigned char>& pubkey_prefix = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS);
if (data.size() == hash.size() + pubkey_prefix.size() && std::equal(pubkey_prefix.begin(), pubkey_prefix.end(), data.begin())) {
std::copy(data.begin() + pubkey_prefix.size(), data.end(), hash.begin());
return CKeyID(hash);
}
// Script-hash-addresses have version 5 (or 196 testnet).
// The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
const std::vector<unsigned char>& script_prefix = params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
if (data.size() == hash.size() + script_prefix.size() && std::equal(script_prefix.begin(), script_prefix.end(), data.begin())) {
std::copy(data.begin() + script_prefix.size(), data.end(), hash.begin());
return CScriptID(hash);
}
}
data.clear();
auto bech = bech32::Decode(str);
if (bech.second.size() > 0 && bech.first == params.Bech32HRP()) {
// Bech32 decoding
int version = bech.second[0]; // The first 5 bit symbol is the witness version (0-16)
// The rest of the symbols are converted witness program bytes.
if (ConvertBits<5, 8, false>(data, bech.second.begin() + 1, bech.second.end())) {
if (version == 0) {
{
WitnessV0KeyHash keyid;
if (data.size() == keyid.size()) {
std::copy(data.begin(), data.end(), keyid.begin());
return keyid;
}
}
{
WitnessV0ScriptHash scriptid;
if (data.size() == scriptid.size()) {
std::copy(data.begin(), data.end(), scriptid.begin());
return scriptid;
}
}
return CNoDestination();
}
if (version > 16 || data.size() < 2 || data.size() > 40) {
return CNoDestination();
}
WitnessUnknown unk;
unk.version = version;
std::copy(data.begin(), data.end(), unk.program);
unk.length = data.size();
return unk;
}
}
return CNoDestination();
}
} // namespace
CKey DecodeSecret(const std::string& str)
{
CKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& privkey_prefix = Params().Base58Prefix(CChainParams::SECRET_KEY);
if ((data.size() == 32 + privkey_prefix.size() || (data.size() == 33 + privkey_prefix.size() && data.back() == 1)) &&
std::equal(privkey_prefix.begin(), privkey_prefix.end(), data.begin())) {
bool compressed = data.size() == 33 + privkey_prefix.size();
key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed);
}
}
memory_cleanse(data.data(), data.size());
return key;
}
std::string EncodeSecret(const CKey& key)
{
assert(key.IsValid());
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::SECRET_KEY);
data.insert(data.end(), key.begin(), key.end());
if (key.IsCompressed()) {
data.push_back(1);
}
std::string ret = EncodeBase58Check(data);
memory_cleanse(data.data(), data.size());
return ret;
}
CExtPubKey DecodeExtPubKey(const std::string& str)
{
CExtPubKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY);
if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) {
key.Decode(data.data() + prefix.size());
}
}
return key;
}
std::string EncodeExtPubKey(const CExtPubKey& key)
{
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY);
size_t size = data.size();
data.resize(size + BIP32_EXTKEY_SIZE);
key.Encode(data.data() + size);
std::string ret = EncodeBase58Check(data);
return ret;
}
CExtKey DecodeExtKey(const std::string& str)
{
CExtKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY);
if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) {
key.Decode(data.data() + prefix.size());
}
}
return key;
}
std::string EncodeExtKey(const CExtKey& key)
{
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY);
size_t size = data.size();
data.resize(size + BIP32_EXTKEY_SIZE);
key.Encode(data.data() + size);
std::string ret = EncodeBase58Check(data);
memory_cleanse(data.data(), data.size());
return ret;
}
std::string EncodeDestination(const CTxDestination& dest)
{
return boost::apply_visitor(DestinationEncoder(Params()), dest);
}
CTxDestination DecodeDestination(const std::string& str)
{
return DecodeDestination(str, Params());
}
bool IsValidDestinationString(const std::string& str, const CChainParams& params)
{
return IsValidDestination(DecodeDestination(str, params));
}
bool IsValidDestinationString(const std::string& str)
{
return IsValidDestinationString(str, Params());
}

View file

@ -14,12 +14,6 @@
#ifndef BITCOIN_BASE58_H #ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H #define BITCOIN_BASE58_H
#include <chainparams.h>
#include <key.h>
#include <pubkey.h>
#include <script/standard.h>
#include <support/allocators/zeroafterfree.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -56,25 +50,12 @@ std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
* Decode a base58-encoded string (psz) that includes a checksum into a byte * Decode a base58-encoded string (psz) that includes a checksum into a byte
* vector (vchRet), return true if decoding is successful * vector (vchRet), return true if decoding is successful
*/ */
inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet); bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet);
/** /**
* Decode a base58-encoded string (str) that includes a checksum into a byte * Decode a base58-encoded string (str) that includes a checksum into a byte
* vector (vchRet), return true if decoding is successful * vector (vchRet), return true if decoding is successful
*/ */
inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet); bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet);
CKey DecodeSecret(const std::string& str);
std::string EncodeSecret(const CKey& key);
CExtKey DecodeExtKey(const std::string& str);
std::string EncodeExtKey(const CExtKey& extkey);
CExtPubKey DecodeExtPubKey(const std::string& str);
std::string EncodeExtPubKey(const CExtPubKey& extpubkey);
std::string EncodeDestination(const CTxDestination& dest);
CTxDestination DecodeDestination(const std::string& str);
bool IsValidDestinationString(const std::string& str);
bool IsValidDestinationString(const std::string& str, const CChainParams& params);
#endif // BITCOIN_BASE58_H #endif // BITCOIN_BASE58_H

View file

@ -6,11 +6,11 @@
#include <config/bitcoin-config.h> #include <config/bitcoin-config.h>
#endif #endif
#include <base58.h>
#include <clientversion.h> #include <clientversion.h>
#include <coins.h> #include <coins.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <core_io.h> #include <core_io.h>
#include <key_io.h>
#include <keystore.h> #include <keystore.h>
#include <policy/policy.h> #include <policy/policy.h>
#include <policy/rbf.h> #include <policy/rbf.h>

View file

@ -4,9 +4,9 @@
#include <core_io.h> #include <core_io.h>
#include <base58.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <consensus/validation.h> #include <consensus/validation.h>
#include <key_io.h>
#include <script/script.h> #include <script/script.h>
#include <script/standard.h> #include <script/standard.h>
#include <serialize.h> #include <serialize.h>

View file

@ -4,9 +4,9 @@
#include <httprpc.h> #include <httprpc.h>
#include <base58.h>
#include <chainparams.h> #include <chainparams.h>
#include <httpserver.h> #include <httpserver.h>
#include <key_io.h>
#include <rpc/protocol.h> #include <rpc/protocol.h>
#include <rpc/server.h> #include <rpc/server.h>
#include <random.h> #include <random.h>

223
src/key_io.cpp Normal file
View file

@ -0,0 +1,223 @@
// Copyright (c) 2014-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <key_io.h>
#include <base58.h>
#include <bech32.h>
#include <script/script.h>
#include <utilstrencodings.h>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <assert.h>
#include <string.h>
#include <algorithm>
namespace
{
class DestinationEncoder : public boost::static_visitor<std::string>
{
private:
const CChainParams& m_params;
public:
DestinationEncoder(const CChainParams& params) : m_params(params) {}
std::string operator()(const CKeyID& id) const
{
std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::PUBKEY_ADDRESS);
data.insert(data.end(), id.begin(), id.end());
return EncodeBase58Check(data);
}
std::string operator()(const CScriptID& id) const
{
std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
data.insert(data.end(), id.begin(), id.end());
return EncodeBase58Check(data);
}
std::string operator()(const WitnessV0KeyHash& id) const
{
std::vector<unsigned char> data = {0};
ConvertBits<8, 5, true>(data, id.begin(), id.end());
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const WitnessV0ScriptHash& id) const
{
std::vector<unsigned char> data = {0};
ConvertBits<8, 5, true>(data, id.begin(), id.end());
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const WitnessUnknown& id) const
{
if (id.version < 1 || id.version > 16 || id.length < 2 || id.length > 40) {
return {};
}
std::vector<unsigned char> data = {(unsigned char)id.version};
ConvertBits<8, 5, true>(data, id.program, id.program + id.length);
return bech32::Encode(m_params.Bech32HRP(), data);
}
std::string operator()(const CNoDestination& no) const { return {}; }
};
CTxDestination DecodeDestination(const std::string& str, const CChainParams& params)
{
std::vector<unsigned char> data;
uint160 hash;
if (DecodeBase58Check(str, data)) {
// base58-encoded Bitcoin addresses.
// Public-key-hash-addresses have version 0 (or 111 testnet).
// The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
const std::vector<unsigned char>& pubkey_prefix = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS);
if (data.size() == hash.size() + pubkey_prefix.size() && std::equal(pubkey_prefix.begin(), pubkey_prefix.end(), data.begin())) {
std::copy(data.begin() + pubkey_prefix.size(), data.end(), hash.begin());
return CKeyID(hash);
}
// Script-hash-addresses have version 5 (or 196 testnet).
// The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
const std::vector<unsigned char>& script_prefix = params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
if (data.size() == hash.size() + script_prefix.size() && std::equal(script_prefix.begin(), script_prefix.end(), data.begin())) {
std::copy(data.begin() + script_prefix.size(), data.end(), hash.begin());
return CScriptID(hash);
}
}
data.clear();
auto bech = bech32::Decode(str);
if (bech.second.size() > 0 && bech.first == params.Bech32HRP()) {
// Bech32 decoding
int version = bech.second[0]; // The first 5 bit symbol is the witness version (0-16)
// The rest of the symbols are converted witness program bytes.
if (ConvertBits<5, 8, false>(data, bech.second.begin() + 1, bech.second.end())) {
if (version == 0) {
{
WitnessV0KeyHash keyid;
if (data.size() == keyid.size()) {
std::copy(data.begin(), data.end(), keyid.begin());
return keyid;
}
}
{
WitnessV0ScriptHash scriptid;
if (data.size() == scriptid.size()) {
std::copy(data.begin(), data.end(), scriptid.begin());
return scriptid;
}
}
return CNoDestination();
}
if (version > 16 || data.size() < 2 || data.size() > 40) {
return CNoDestination();
}
WitnessUnknown unk;
unk.version = version;
std::copy(data.begin(), data.end(), unk.program);
unk.length = data.size();
return unk;
}
}
return CNoDestination();
}
} // namespace
CKey DecodeSecret(const std::string& str)
{
CKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& privkey_prefix = Params().Base58Prefix(CChainParams::SECRET_KEY);
if ((data.size() == 32 + privkey_prefix.size() || (data.size() == 33 + privkey_prefix.size() && data.back() == 1)) &&
std::equal(privkey_prefix.begin(), privkey_prefix.end(), data.begin())) {
bool compressed = data.size() == 33 + privkey_prefix.size();
key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed);
}
}
memory_cleanse(data.data(), data.size());
return key;
}
std::string EncodeSecret(const CKey& key)
{
assert(key.IsValid());
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::SECRET_KEY);
data.insert(data.end(), key.begin(), key.end());
if (key.IsCompressed()) {
data.push_back(1);
}
std::string ret = EncodeBase58Check(data);
memory_cleanse(data.data(), data.size());
return ret;
}
CExtPubKey DecodeExtPubKey(const std::string& str)
{
CExtPubKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY);
if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) {
key.Decode(data.data() + prefix.size());
}
}
return key;
}
std::string EncodeExtPubKey(const CExtPubKey& key)
{
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY);
size_t size = data.size();
data.resize(size + BIP32_EXTKEY_SIZE);
key.Encode(data.data() + size);
std::string ret = EncodeBase58Check(data);
return ret;
}
CExtKey DecodeExtKey(const std::string& str)
{
CExtKey key;
std::vector<unsigned char> data;
if (DecodeBase58Check(str, data)) {
const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY);
if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) {
key.Decode(data.data() + prefix.size());
}
}
return key;
}
std::string EncodeExtKey(const CExtKey& key)
{
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY);
size_t size = data.size();
data.resize(size + BIP32_EXTKEY_SIZE);
key.Encode(data.data() + size);
std::string ret = EncodeBase58Check(data);
memory_cleanse(data.data(), data.size());
return ret;
}
std::string EncodeDestination(const CTxDestination& dest)
{
return boost::apply_visitor(DestinationEncoder(Params()), dest);
}
CTxDestination DecodeDestination(const std::string& str)
{
return DecodeDestination(str, Params());
}
bool IsValidDestinationString(const std::string& str, const CChainParams& params)
{
return IsValidDestination(DecodeDestination(str, params));
}
bool IsValidDestinationString(const std::string& str)
{
return IsValidDestinationString(str, Params());
}

29
src/key_io.h Normal file
View file

@ -0,0 +1,29 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 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_KEYIO_H
#define BITCOIN_KEYIO_H
#include <chainparams.h>
#include <key.h>
#include <pubkey.h>
#include <script/standard.h>
#include <string>
CKey DecodeSecret(const std::string& str);
std::string EncodeSecret(const CKey& key);
CExtKey DecodeExtKey(const std::string& str);
std::string EncodeExtKey(const CExtKey& extkey);
CExtPubKey DecodeExtPubKey(const std::string& str);
std::string EncodeExtPubKey(const CExtPubKey& extpubkey);
std::string EncodeDestination(const CTxDestination& dest);
CTxDestination DecodeDestination(const std::string& str);
bool IsValidDestinationString(const std::string& str);
bool IsValidDestinationString(const std::string& str, const CChainParams& params);
#endif // BITCOIN_KEYIO_H

View file

@ -7,10 +7,9 @@
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/walletmodel.h> #include <qt/walletmodel.h>
#include <base58.h> #include <key_io.h>
#include <wallet/wallet.h> #include <wallet/wallet.h>
#include <QFont> #include <QFont>
#include <QDebug> #include <QDebug>

View file

@ -4,7 +4,7 @@
#include <qt/bitcoinaddressvalidator.h> #include <qt/bitcoinaddressvalidator.h>
#include <base58.h> #include <key_io.h>
/* Base58 characters are: /* Base58 characters are:
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

View file

@ -15,6 +15,7 @@
#include <wallet/coincontrol.h> #include <wallet/coincontrol.h>
#include <init.h> #include <init.h>
#include <key_io.h>
#include <policy/fees.h> #include <policy/fees.h>
#include <policy/policy.h> #include <policy/policy.h>
#include <validation.h> // For mempool #include <validation.h> // For mempool

View file

@ -9,7 +9,10 @@
#include <qt/qvalidatedlineedit.h> #include <qt/qvalidatedlineedit.h>
#include <qt/walletmodel.h> #include <qt/walletmodel.h>
#include <base58.h>
#include <chainparams.h>
#include <primitives/transaction.h> #include <primitives/transaction.h>
#include <key_io.h>
#include <init.h> #include <init.h>
#include <policy/policy.h> #include <policy/policy.h>
#include <protocol.h> #include <protocol.h>

View file

@ -9,6 +9,7 @@
#include <qt/paymentrequestplus.h> #include <qt/paymentrequestplus.h>
#include <script/script.h>
#include <util.h> #include <util.h>
#include <stdexcept> #include <stdexcept>

View file

@ -10,7 +10,8 @@
#include <qt/paymentrequest.pb.h> #include <qt/paymentrequest.pb.h>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#include <base58.h> #include <amount.h>
#include <script/script.h>
#include <openssl/x509.h> #include <openssl/x509.h>

View file

@ -8,9 +8,9 @@
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <base58.h>
#include <chainparams.h> #include <chainparams.h>
#include <policy/policy.h> #include <policy/policy.h>
#include <key_io.h>
#include <ui_interface.h> #include <ui_interface.h>
#include <util.h> #include <util.h>
#include <wallet/wallet.h> #include <wallet/wallet.h>

View file

@ -14,8 +14,8 @@
#include <qt/platformstyle.h> #include <qt/platformstyle.h>
#include <qt/sendcoinsentry.h> #include <qt/sendcoinsentry.h>
#include <base58.h>
#include <chainparams.h> #include <chainparams.h>
#include <key_io.h>
#include <wallet/coincontrol.h> #include <wallet/coincontrol.h>
#include <validation.h> // mempool and minRelayTxFee #include <validation.h> // mempool and minRelayTxFee
#include <ui_interface.h> #include <ui_interface.h>

View file

@ -10,8 +10,8 @@
#include <qt/platformstyle.h> #include <qt/platformstyle.h>
#include <qt/walletmodel.h> #include <qt/walletmodel.h>
#include <base58.h>
#include <init.h> #include <init.h>
#include <key_io.h>
#include <validation.h> // For strMessageMagic #include <validation.h> // For strMessageMagic
#include <wallet/wallet.h> #include <wallet/wallet.h>

View file

@ -8,6 +8,7 @@
#include <qt/test/paymentrequestdata.h> #include <qt/test/paymentrequestdata.h>
#include <amount.h> #include <amount.h>
#include <chainparams.h>
#include <random.h> #include <random.h>
#include <script/script.h> #include <script/script.h>
#include <script/standard.h> #include <script/standard.h>

View file

@ -10,6 +10,7 @@
#include <qt/transactiontablemodel.h> #include <qt/transactiontablemodel.h>
#include <qt/transactionview.h> #include <qt/transactionview.h>
#include <qt/walletmodel.h> #include <qt/walletmodel.h>
#include <key_io.h>
#include <test/test_bitcoin.h> #include <test/test_bitcoin.h>
#include <validation.h> #include <validation.h>
#include <wallet/wallet.h> #include <wallet/wallet.h>

View file

@ -9,8 +9,8 @@
#include <qt/paymentserver.h> #include <qt/paymentserver.h>
#include <qt/transactionrecord.h> #include <qt/transactionrecord.h>
#include <base58.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <key_io.h>
#include <validation.h> #include <validation.h>
#include <script/script.h> #include <script/script.h>
#include <timedata.h> #include <timedata.h>

View file

@ -4,8 +4,8 @@
#include <qt/transactionrecord.h> #include <qt/transactionrecord.h>
#include <base58.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <key_io.h>
#include <validation.h> #include <validation.h>
#include <timedata.h> #include <timedata.h>
#include <wallet/wallet.h> #include <wallet/wallet.h>

View file

@ -14,8 +14,8 @@
#include <qt/sendcoinsdialog.h> #include <qt/sendcoinsdialog.h>
#include <qt/transactiontablemodel.h> #include <qt/transactiontablemodel.h>
#include <base58.h>
#include <chain.h> #include <chain.h>
#include <key_io.h>
#include <keystore.h> #include <keystore.h>
#include <validation.h> #include <validation.h>
#include <net.h> // for g_connman #include <net.h> // for g_connman

View file

@ -5,6 +5,11 @@
#ifndef BITCOIN_QT_WALLETMODEL_H #ifndef BITCOIN_QT_WALLETMODEL_H
#define BITCOIN_QT_WALLETMODEL_H #define BITCOIN_QT_WALLETMODEL_H
#include <amount.h>
#include <key.h>
#include <serialize.h>
#include <script/standard.h>
#include <qt/paymentrequestplus.h> #include <qt/paymentrequestplus.h>
#include <qt/walletmodeltransaction.h> #include <qt/walletmodeltransaction.h>

View file

@ -3,7 +3,6 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h>
#include <amount.h> #include <amount.h>
#include <chain.h> #include <chain.h>
#include <chainparams.h> #include <chainparams.h>
@ -13,6 +12,7 @@
#include <core_io.h> #include <core_io.h>
#include <init.h> #include <init.h>
#include <validation.h> #include <validation.h>
#include <key_io.h>
#include <miner.h> #include <miner.h>
#include <net.h> #include <net.h>
#include <policy/fees.h> #include <policy/fees.h>

View file

@ -3,12 +3,12 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h>
#include <chain.h> #include <chain.h>
#include <clientversion.h> #include <clientversion.h>
#include <core_io.h> #include <core_io.h>
#include <crypto/ripemd160.h> #include <crypto/ripemd160.h>
#include <init.h> #include <init.h>
#include <key_io.h>
#include <validation.h> #include <validation.h>
#include <httpserver.h> #include <httpserver.h>
#include <net.h> #include <net.h>

View file

@ -3,7 +3,6 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h>
#include <chain.h> #include <chain.h>
#include <coins.h> #include <coins.h>
#include <consensus/validation.h> #include <consensus/validation.h>
@ -12,6 +11,7 @@
#include <keystore.h> #include <keystore.h>
#include <validation.h> #include <validation.h>
#include <validationinterface.h> #include <validationinterface.h>
#include <key_io.h>
#include <merkleblock.h> #include <merkleblock.h>
#include <net.h> #include <net.h>
#include <policy/policy.h> #include <policy/policy.h>

View file

@ -5,9 +5,9 @@
#include <rpc/server.h> #include <rpc/server.h>
#include <base58.h>
#include <fs.h> #include <fs.h>
#include <init.h> #include <init.h>
#include <key_io.h>
#include <random.h> #include <random.h>
#include <sync.h> #include <sync.h>
#include <ui_interface.h> #include <ui_interface.h>

View file

@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h> #include <key_io.h>
#include <keystore.h> #include <keystore.h>
#include <pubkey.h> #include <pubkey.h>
#include <rpc/protocol.h> #include <rpc/protocol.h>

View file

@ -9,6 +9,7 @@
#include <test/data/base58_keys_valid.json.h> #include <test/data/base58_keys_valid.json.h>
#include <key.h> #include <key.h>
#include <key_io.h>
#include <script/script.h> #include <script/script.h>
#include <test/test_bitcoin.h> #include <test/test_bitcoin.h>
#include <uint256.h> #include <uint256.h>

View file

@ -4,8 +4,8 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <base58.h>
#include <key.h> #include <key.h>
#include <key_io.h>
#include <uint256.h> #include <uint256.h>
#include <util.h> #include <util.h>
#include <utilstrencodings.h> #include <utilstrencodings.h>

View file

@ -4,9 +4,9 @@
#include <bloom.h> #include <bloom.h>
#include <base58.h>
#include <clientversion.h> #include <clientversion.h>
#include <key.h> #include <key.h>
#include <key_io.h>
#include <merkleblock.h> #include <merkleblock.h>
#include <primitives/block.h> #include <primitives/block.h>
#include <random.h> #include <random.h>

View file

@ -4,7 +4,7 @@
#include <key.h> #include <key.h>
#include <base58.h> #include <key_io.h>
#include <script/script.h> #include <script/script.h>
#include <uint256.h> #include <uint256.h>
#include <util.h> #include <util.h>

View file

@ -5,8 +5,8 @@
#include <rpc/server.h> #include <rpc/server.h>
#include <rpc/client.h> #include <rpc/client.h>
#include <base58.h>
#include <core_io.h> #include <core_io.h>
#include <key_io.h>
#include <netbase.h> #include <netbase.h>
#include <test/test_bitcoin.h> #include <test/test_bitcoin.h>

View file

@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <base58.h>
#include <chain.h> #include <chain.h>
#include <key_io.h>
#include <rpc/safemode.h> #include <rpc/safemode.h>
#include <rpc/server.h> #include <rpc/server.h>
#include <wallet/init.h> #include <wallet/init.h>

View file

@ -4,12 +4,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <amount.h> #include <amount.h>
#include <base58.h>
#include <chain.h> #include <chain.h>
#include <consensus/validation.h> #include <consensus/validation.h>
#include <core_io.h> #include <core_io.h>
#include <httpserver.h> #include <httpserver.h>
#include <validation.h> #include <validation.h>
#include <key_io.h>
#include <net.h> #include <net.h>
#include <policy/feerate.h> #include <policy/feerate.h>
#include <policy/fees.h> #include <policy/fees.h>

View file

@ -5,7 +5,6 @@
#include <wallet/wallet.h> #include <wallet/wallet.h>
#include <base58.h>
#include <checkpoints.h> #include <checkpoints.h>
#include <chain.h> #include <chain.h>
#include <wallet/coincontrol.h> #include <wallet/coincontrol.h>
@ -14,6 +13,7 @@
#include <fs.h> #include <fs.h>
#include <wallet/init.h> #include <wallet/init.h>
#include <key.h> #include <key.h>
#include <key_io.h>
#include <keystore.h> #include <keystore.h>
#include <validation.h> #include <validation.h>
#include <net.h> #include <net.h>

View file

@ -5,10 +5,10 @@
#include <wallet/walletdb.h> #include <wallet/walletdb.h>
#include <base58.h>
#include <consensus/tx_verify.h> #include <consensus/tx_verify.h>
#include <consensus/validation.h> #include <consensus/validation.h>
#include <fs.h> #include <fs.h>
#include <key_io.h>
#include <protocol.h> #include <protocol.h>
#include <serialize.h> #include <serialize.h>
#include <sync.h> #include <sync.h>