Extract masternode vin information from output
| 391 | |
| 392 | // Extract masternode vin information from output |
| 393 | bool 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 |
| 419 | vector<COutput> CActiveMasternode::SelectCoinsMasternode() { |
nothing calls this directly
no test coverage detected