Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,824 Lines • ▼ Show 20 Lines | for (ScriptPubKeyMan *spk_man : GetAllScriptPubKeyMans()) { | ||||
// spk_man->SignTransaction will return true if the transaction is | // spk_man->SignTransaction will return true if the transaction is | ||||
// complete, so we can exit early and return true if that happens | // complete, so we can exit early and return true if that happens | ||||
if (spk_man->SignTransaction(tx, coins, sighash, input_errors)) { | if (spk_man->SignTransaction(tx, coins, sighash, input_errors)) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
// At this point, one input was not fully signed otherwise we would have | // At this point, one input was not fully signed otherwise we would have | ||||
// exited already Find that input and figure out what went wrong. | // exited already | ||||
for (size_t i = 0; i < tx.vin.size(); i++) { | |||||
// Get the prevout | |||||
CTxIn &txin = tx.vin[i]; | |||||
auto coin = coins.find(txin.prevout); | |||||
if (coin == coins.end() || coin->second.IsSpent()) { | |||||
input_errors[i] = "Input not found or already spent"; | |||||
continue; | |||||
} | |||||
// Check if this input is complete | |||||
SignatureData sigdata = | |||||
DataFromTransaction(tx, i, coin->second.GetTxOut()); | |||||
if (!sigdata.complete) { | |||||
input_errors[i] = "Unable to sign input, missing keys"; | |||||
continue; | |||||
} | |||||
} | |||||
// When there are no available providers for the remaining inputs, use the | // When there are no available providers for the remaining inputs, use the | ||||
// legacy provider so we can get proper error messages. | // legacy provider so we can get proper error messages. | ||||
auto legacy_spk_man = GetLegacyScriptPubKeyMan(); | auto legacy_spk_man = GetLegacyScriptPubKeyMan(); | ||||
if (legacy_spk_man && | if (legacy_spk_man && | ||||
legacy_spk_man->SignTransaction(tx, coins, sighash, input_errors)) { | legacy_spk_man->SignTransaction(tx, coins, sighash, input_errors)) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,262 Lines • Show Last 20 Lines |