14
14
15
15
#ifdef ENABLE_EXTERNAL_SIGNER
16
16
17
- ExternalSigner::ExternalSigner (const std::string& command, const std::string& fingerprint, std::string chain, std::string name): m_command(command), m_fingerprint(fingerprint), m_chain(chain), m_name(name) {}
17
+ ExternalSigner::ExternalSigner (const std::string& command, const std::string& fingerprint, const std::string chain, const std::string name): m_command(command), m_fingerprint(fingerprint), m_chain(chain), m_name(name) {}
18
18
19
19
const std::string ExternalSigner::NetworkArg () const
20
20
{
21
21
return " --chain " + m_chain;
22
22
}
23
23
24
- bool ExternalSigner::Enumerate (const std::string& command, std::vector<ExternalSigner>& signers, std::string chain)
24
+ bool ExternalSigner::Enumerate (const std::string& command, std::vector<ExternalSigner>& signers, const std::string chain)
25
25
{
26
26
// Call <command> enumerate
27
27
const UniValue result = RunCommandParseJSON (command + " enumerate" );
@@ -42,10 +42,10 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
42
42
if (fingerprint.isNull ()) {
43
43
throw ExternalSignerException (strprintf (" '%s' received invalid response, missing signer fingerprint" , command));
44
44
}
45
- std::string fingerprintStr = fingerprint.get_str ();
45
+ const std::string fingerprintStr = fingerprint.get_str ();
46
46
// Skip duplicate signer
47
47
bool duplicate = false ;
48
- for (ExternalSigner signer : signers) {
48
+ for (const ExternalSigner& signer : signers) {
49
49
if (signer.m_fingerprint .compare (fingerprintStr) == 0 ) duplicate = true ;
50
50
}
51
51
if (duplicate) break ;
@@ -64,7 +64,7 @@ UniValue ExternalSigner::DisplayAddress(const std::string& descriptor) const
64
64
return RunCommandParseJSON (m_command + " --fingerprint \" " + m_fingerprint + " \" " + NetworkArg () + " displayaddress --desc \" " + descriptor + " \" " );
65
65
}
66
66
67
- UniValue ExternalSigner::GetDescriptors (int account)
67
+ UniValue ExternalSigner::GetDescriptors (const int account)
68
68
{
69
69
return RunCommandParseJSON (m_command + " --fingerprint \" " + m_fingerprint + " \" " + NetworkArg () + " getdescriptors --account " + strprintf (" %d" , account));
70
70
}
@@ -79,7 +79,7 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
79
79
bool match = false ;
80
80
for (unsigned int i = 0 ; i < psbtx.inputs .size (); ++i) {
81
81
const PSBTInput& input = psbtx.inputs [i];
82
- for (auto entry : input.hd_keypaths ) {
82
+ for (const auto & entry : input.hd_keypaths ) {
83
83
if (m_fingerprint == strprintf (" %08x" , ReadBE32 (entry.second .fingerprint ))) match = true ;
84
84
}
85
85
}
@@ -89,8 +89,8 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
89
89
return false ;
90
90
}
91
91
92
- std::string command = m_command + " --stdin --fingerprint \" " + m_fingerprint + " \" " + NetworkArg ();
93
- std::string stdinStr = " signtx \" " + EncodeBase64 (ssTx.str ()) + " \" " ;
92
+ const std::string command = m_command + " --stdin --fingerprint \" " + m_fingerprint + " \" " + NetworkArg ();
93
+ const std::string stdinStr = " signtx \" " + EncodeBase64 (ssTx.str ()) + " \" " ;
94
94
95
95
const UniValue signer_result = RunCommandParseJSON (command, stdinStr);
96
96
0 commit comments