MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetVinFromOutput

Method GetVinFromOutput

src/activemasternode.cpp:393–416  ·  view source on GitHub ↗

Extract masternode vin information from output

Source from the content-addressed store, hash-verified

391
392// Extract masternode vin information from output
393bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey) {
394
395 CScript pubScript;
396
397 vin = CTxIn(out.tx->GetHash(), out.i);
398 pubScript = out.tx->vout[out.i].scriptPubKey; // the inputs PubKey
399
400 CTxDestination address1;
401 ExtractDestination(pubScript, address1);
402
403 const CKeyID* keyID = boost::get<CKeyID>(&address1);
404 if (!keyID) {
405 LogPrintf("CActiveMasternode::GetMasterNodeVin - Address does not refer to a key\n");
406 return false;
407 }
408
409 if (!pwalletMain->GetKey(*keyID, secretKey)) {
410 LogPrintf ("CActiveMasternode::GetMasterNodeVin - Private key for address is not known\n");
411 return false;
412 }
413
414 pubkey = secretKey.GetPubKey();
415 return true;
416}
417
418// get all possible outputs for running masternode
419vector<COutput> CActiveMasternode::SelectCoinsMasternode() {

Callers

nothing calls this directly

Calls 5

ExtractDestinationFunction · 0.85
CTxInClass · 0.70
GetHashMethod · 0.45
GetKeyMethod · 0.45
GetPubKeyMethod · 0.45

Tested by

no test coverage detected