aboutsummaryrefslogtreecommitdiff
path: root/src/util/strencodings.cpp
diff options
context:
space:
mode:
authorMeshCollider <dobsonsa68@gmail.com>2019-02-15 12:10:52 +1300
committerMeshCollider <dobsonsa68@gmail.com>2019-02-15 12:11:28 +1300
commit8d0ec74801f7b185087d1b6dbb82bdd6fbd8dcc5 (patch)
tree29ff5489b7260281e1a3caeed80238e77a30c40a /src/util/strencodings.cpp
parent33480c6366583736ceb641d077733b867730e941 (diff)
parentcb3511b9d5f3d8a86e090ebed5a4aeaf758430b8 (diff)
downloadbitcoin-8d0ec74801f7b185087d1b6dbb82bdd6fbd8dcc5.tar.xz
Merge #14021: Import key origin data through descriptors in importmulti
cb3511b9d Add release notes for importing key origin info change (Andrew Chow) 4c75a69f3 Test importing descriptors with key origin information (Andrew Chow) 02d6586d7 Import KeyOriginData when importing descriptors (Andrew Chow) 3d235dff5 Implement a function to add KeyOriginInfo to a wallet (Andrew Chow) eab63bc26 Store key origin info in key metadata (Andrew Chow) 345bff601 Remove hdmasterkeyid (Andrew Chow) bac8c676a Add a method to CWallet to write just CKeyMetadata (Andrew Chow) e7652d3f6 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow) c45415f73 Refactor keymetadata writing to a separate method (Andrew Chow) Pull request description: This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet. In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this. Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
Diffstat (limited to 'src/util/strencodings.cpp')
-rw-r--r--src/util/strencodings.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp
index b55547bc63..0acbb4f117 100644
--- a/src/util/strencodings.cpp
+++ b/src/util/strencodings.cpp
@@ -546,47 +546,6 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
return true;
}
-bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
-{
- std::stringstream ss(keypath_str);
- std::string item;
- bool first = true;
- while (std::getline(ss, item, '/')) {
- if (item.compare("m") == 0) {
- if (first) {
- first = false;
- continue;
- }
- return false;
- }
- // Finds whether it is hardened
- uint32_t path = 0;
- size_t pos = item.find("'");
- if (pos != std::string::npos) {
- // The hardened tick can only be in the last index of the string
- if (pos != item.size() - 1) {
- return false;
- }
- path |= 0x80000000;
- item = item.substr(0, item.size() - 1); // Drop the last character which is the hardened tick
- }
-
- // Ensure this is only numbers
- if (item.find_first_not_of( "0123456789" ) != std::string::npos) {
- return false;
- }
- uint32_t number;
- if (!ParseUInt32(item, &number)) {
- return false;
- }
- path |= number;
-
- keypath.push_back(path);
- first = false;
- }
- return true;
-}
-
void Downcase(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), [](char c){return ToLower(c);});