forked from IPCChain/ipchain
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1ae72a570eced37b94b4885711e3f9fcf27a7bdb.svn-base
More file actions
132 lines (109 loc) · 2.92 KB
/
Copy path1ae72a570eced37b94b4885711e3f9fcf27a7bdb.svn-base
File metadata and controls
132 lines (109 loc) · 2.92 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include <iostream>
#include "../util.h"
#include "ConsensusAccount.h"
CConsensusAccount::CConsensusAccount(const uint160& pubkeyhash, CAmount& JoinIPC, const uint256& hash, int64_t credit)
{
mPubicKey160hash = pubkeyhash;
mSortValue = uint256();
miCredit = credit;
txhash = hash;
creditBackup = 0;
mJoinIPC = JoinIPC;
}
CConsensusAccount::CConsensusAccount(const uint160& pubkeyhash, CAmount& JoinIPC, int64_t credit)
{
mPubicKey160hash = pubkeyhash;
mSortValue = uint256();
miCredit = credit;
txhash = uint256();
creditBackup = 0;
mJoinIPC = JoinIPC;
}
CConsensusAccount::CConsensusAccount(const uint160& pubkeyhash)
{
mPubicKey160hash = pubkeyhash;
mSortValue = uint256();
miCredit = 0;
mJoinIPC = 0;
}
CConsensusAccount::CConsensusAccount()
{
miCredit = 0;
creditBackup = 0;
mJoinIPC = 0;
}
CConsensusAccount::CConsensusAccount(const CConsensusAccount* rhs) {
this->mPubicKey160hash = rhs->mPubicKey160hash;
this->mSortValue = rhs->mSortValue;
this->miCredit = rhs->miCredit;
this->mJoinIPC = rhs->mJoinIPC;
}
CConsensusAccount::~CConsensusAccount()
{
}
CConsensusAccount& CConsensusAccount::operator= (const CConsensusAccount& rhs) {
if (this == &rhs){
return *this;
}
this->mPubicKey160hash = rhs.mPubicKey160hash;
this->mSortValue = rhs.mSortValue;
this->miCredit = rhs.miCredit;
this->creditBackup = rhs.creditBackup;
this->mJoinIPC = rhs.mJoinIPC;
this->txhash = rhs.txhash;
return *this;
}
uint256 CConsensusAccount::getSortValue(){
return mSortValue;
}
void CConsensusAccount::setSortValue(uint256 uSortValue) {
mSortValue = uSortValue;
}
uint160 CConsensusAccount::getPubicKey160hash() {
return mPubicKey160hash;
}
void CConsensusAccount::debugOut() {
LogPrintf("%s ", mPubicKey160hash.GetHex().c_str());
}
CAmount CConsensusAccount::getJoinIPC() {
return mJoinIPC;
}
void CConsensusAccount::backupCredit() {
LogPrintf("[CConsensusAccount::backupCredit] Back up the current credit value %d to the backup value, override the original backup value %d\n",
miCredit, creditBackup);
creditBackup = miCredit;
};
void CConsensusAccount::revertCredit() {
LogPrintf("[CConsensusAccount::revertCredit] From the backup value %d recovery of credit value,Cover the original credit value %d\n", creditBackup, miCredit);
miCredit = creditBackup;
};
CLocalAccount::CLocalAccount()
{
std::string strPublicKey;
CDpocInfo::Instance().getLocalAccoutVar(strPublicKey);
pubicKey160hash.SetHex(strPublicKey);
}
bool CLocalAccount::IsNull()
{
if (pubicKey160hash.IsNull())
{
return true;
}
return false;
}
int CLocalAccount::Get160Hash(uint160 &hash160)
{
hash160 = pubicKey160hash;
return 0;
}
int CLocalAccount::Set160Hash()
{
std::string strPublicKey;
CDpocInfo::Instance().getLocalAccoutVar(strPublicKey);
pubicKey160hash.SetHex(strPublicKey);
return 0;
}
CLocalAccount::CLocalAccount(const CLocalAccount& loaclAccount)
{
pubicKey160hash = loaclAccount.pubicKey160hash;
}