activethrone.h 2.74 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Crowncoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef ACTIVETHRONE_H
#define ACTIVETHRONE_H

#include "bignum.h"
#include "sync.h"
#include "net.h"
#include "key.h"
#include "core.h"
#include "init.h"
#include "wallet.h"
#include "darksend.h"

// Responsible for activating the Throne and pinging the network
class CActiveThrone
{
public:
	// Initialized by init.cpp
	// Keys for the main Throne
	CPubKey pubKeyThrone;

	// Initialized while registering Throne
	CTxIn vin;
    CService service;

    int status;
    std::string notCapableReason;

    CActiveThrone()
    {        
        status = THRONE_NOT_PROCESSED;
    }

    /// Manage status of main Throne
    void ManageStatus(); 

    /// Ping for main Throne
    bool Dseep(std::string& errorMessage); 
    /// Ping for any Throne
    bool Dseep(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string &retErrorMessage, bool stop); 

    /// Stop main Throne
    bool StopThroNe(std::string& errorMessage); 
    /// Stop remote Throne
    bool StopThroNe(std::string strService, std::string strKeyThrone, std::string& errorMessage); 
    /// Stop any Throne
    bool StopThroNe(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string& errorMessage); 

    /// Register remote Throne
Minato's avatar
Minato committed
53
    bool Register(std::string strService, std::string strKey, std::string txHash, std::string strOutputIndex, std::string& errorMessage); 
54
    /// Register any Throne
Minato's avatar
Minato committed
55
56
57
    bool Register(CTxIn vin, CService service, CKey key, CPubKey pubKey, CKey keyThrone, CPubKey pubKeyThrone, std::string &retErrorMessage); 

    bool RegisterByPubKey(std::string strService, std::string strKeyThrone, std::string collateralAddress, std::string& errorMessage); // register for a specific collateral address
58
59
60
61

    /// Get 1000DRK input that can be used for the Throne
    bool GetThroNeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey);
    bool GetThroNeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex);
Minato's avatar
Minato committed
62
63
64
65
66

    bool GetThroNeVinForPubKey(std::string collateralAddress, CTxIn& vin, CPubKey& pubkey, CKey& secretKey);

    bool GetThroNeVinForPubKey(std::string collateralAddress, CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex);

67
    vector<COutput> SelectCoinsThrone();
Minato's avatar
Minato committed
68
69
70
 
    vector<COutput> SelectCoinsThroneForPubKey(std::string collateralAddress);

71
72
73
74
75
76
77
    bool GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey);

    /// Enable hot wallet mode (run a Throne with no funds)
    bool EnableHotColdThroNe(CTxIn& vin, CService& addr);
};

#endif