mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
scripted-diff: Use UniValue::find_value method
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i 's/find_value\(([^ ,]+), /\1.find_value(/g' $(git grep -l find_value) -END VERIFY SCRIPT-
This commit is contained in:
@@ -30,7 +30,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
|
||||
}
|
||||
for (const UniValue& signer : result.getValues()) {
|
||||
// Check for error
|
||||
const UniValue& error = find_value(signer, "error");
|
||||
const UniValue& error = signer.find_value("error");
|
||||
if (!error.isNull()) {
|
||||
if (!error.isStr()) {
|
||||
throw std::runtime_error(strprintf("'%s' error", command));
|
||||
@@ -38,7 +38,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
|
||||
throw std::runtime_error(strprintf("'%s' error: %s", command, error.getValStr()));
|
||||
}
|
||||
// Check if fingerprint is present
|
||||
const UniValue& fingerprint = find_value(signer, "fingerprint");
|
||||
const UniValue& fingerprint = signer.find_value("fingerprint");
|
||||
if (fingerprint.isNull()) {
|
||||
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
|
||||
}
|
||||
@@ -50,7 +50,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
|
||||
}
|
||||
if (duplicate) break;
|
||||
std::string name;
|
||||
const UniValue& model_field = find_value(signer, "model");
|
||||
const UniValue& model_field = signer.find_value("model");
|
||||
if (model_field.isStr() && model_field.getValStr() != "") {
|
||||
name += model_field.getValStr();
|
||||
}
|
||||
@@ -97,19 +97,19 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
|
||||
|
||||
const UniValue signer_result = RunCommandParseJSON(command, stdinStr);
|
||||
|
||||
if (find_value(signer_result, "error").isStr()) {
|
||||
error = find_value(signer_result, "error").get_str();
|
||||
if (signer_result.find_value("error").isStr()) {
|
||||
error = signer_result.find_value("error").get_str();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!find_value(signer_result, "psbt").isStr()) {
|
||||
if (!signer_result.find_value("psbt").isStr()) {
|
||||
error = "Unexpected result from signer";
|
||||
return false;
|
||||
}
|
||||
|
||||
PartiallySignedTransaction signer_psbtx;
|
||||
std::string signer_psbt_error;
|
||||
if (!DecodeBase64PSBT(signer_psbtx, find_value(signer_result, "psbt").get_str(), signer_psbt_error)) {
|
||||
if (!DecodeBase64PSBT(signer_psbtx, signer_result.find_value("psbt").get_str(), signer_psbt_error)) {
|
||||
error = strprintf("TX decode failed %s", signer_psbt_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user