99#include < node/blockstorage.h>
1010#include < rpc/util.h>
1111#include < rpc/client.h>
12- #include < federation_deposit .h>
13- #include < federation_validator .h>
12+ #include < anduro_deposit .h>
13+ #include < anduro_validator .h>
1414
1515using node::BlockManager;
1616using node::ReadBlockFromDisk;
1717// temporary storage for including presigned signature on next block
18- std::vector<FederationTxOut > tDeposits;
19- // check blocks are fully synced to active federation presign validation
18+ std::vector<AnduroTxOut > tDeposits;
19+ // check blocks are fully synced to active anduro presign validation
2020bool isValidationActivate = false ;
2121// temporary storage for deposit address
2222std::string depositAddress = " " ;
2323// temporary storage for withdraw address
2424std::string burnAddress = " " ;
2525
2626/* *
27- * Include presigned signature from federation .
27+ * Include presigned signature from anduro .
2828 */
29- void includePreSignedSignature (std::vector<FederationTxOut > txOuts) {
29+ void includePreSignedSignature (std::vector<AnduroTxOut > txOuts) {
3030 if (txOuts.size () == 0 ) {
3131 return ;
3232 }
3333 if (!isSignatureAlreadyExist (txOuts[0 ])) {
34- for (const FederationTxOut & tx : txOuts) {
34+ for (const AnduroTxOut & tx : txOuts) {
3535 tDeposits.push_back (tx);
3636 depositAddress = tx.depositAddress ;
3737 burnAddress = tx.burnAddress ;
3838 }
3939 }
4040}
4141
42- bool isSignatureAlreadyExist (FederationTxOut txOut) {
42+ bool isSignatureAlreadyExist (AnduroTxOut txOut) {
4343 bool isExist = false ;
44- std::vector<FederationTxOut > pending_deposits = listPendingDepositTransaction (txOut.block_height );
44+ std::vector<AnduroTxOut > pending_deposits = listPendingDepositTransaction (txOut.block_height );
4545 if (pending_deposits.size () > 0 ) {
4646 isExist = true ;
4747 }
4848 return isExist;
4949}
5050
51- bool isSpecialTxoutValid (std::vector<FederationTxOut > txOuts, ChainstateManager& chainman) {
51+ bool isSpecialTxoutValid (std::vector<AnduroTxOut > txOuts, ChainstateManager& chainman) {
5252
5353 if (txOuts.size ()==0 ) {
5454 return false ;
@@ -59,7 +59,7 @@ bool isSpecialTxoutValid(std::vector<FederationTxOut> txOuts, ChainstateManager&
5959 if (txOuts[0 ].block_height <= blockindex) {
6060 blockindex = blockindex - 1 ;
6161 }
62- // get block to find the eligible federation keys to be signed on presigned block
62+ // get block to find the eligible anduro keys to be signed on presigned block
6363 CBlock block;
6464 if (!ReadBlockFromDisk (block, CHECK_NONFATAL (active_chain[blockindex]), Params ().GetConsensus ())) {
6565 LogPrintf (" Error reading block from disk at index %d\n " , CHECK_NONFATAL (active_chain[blockindex])->GetBlockHash ().ToString ());
@@ -68,7 +68,7 @@ bool isSpecialTxoutValid(std::vector<FederationTxOut> txOuts, ChainstateManager&
6868 UniValue messages (UniValue::VARR);
6969 int tIndex = 1 ;
7070 // preparing message for signature verification
71- for (const FederationTxOut & txOut : txOuts) {
71+ for (const AnduroTxOut & txOut : txOuts) {
7272
7373 CTxDestination address;
7474 ExtractDestination (txOut.scriptPubKey , address);
@@ -84,7 +84,7 @@ bool isSpecialTxoutValid(std::vector<FederationTxOut> txOuts, ChainstateManager&
8484 messages.push_back (message);
8585 }
8686 // check signature is valid
87- bool isValid = validateFederationSignature (txOuts[0 ].witness ,messages.write (),block.currentKeys );
87+ bool isValid = validateAnduroSignature (txOuts[0 ].witness ,messages.write (),block.currentKeys );
8888
8989 if (isValid) {
9090 return true ;
@@ -96,13 +96,13 @@ bool isSpecialTxoutValid(std::vector<FederationTxOut> txOuts, ChainstateManager&
9696/* *
9797 * This function list all presigned pegin details for upcoming blocks by height
9898 */
99- std::vector<FederationTxOut > listPendingDepositTransaction (uint32_t block_height) {
99+ std::vector<AnduroTxOut > listPendingDepositTransaction (uint32_t block_height) {
100100 if (block_height == -1 ) {
101101 return tDeposits;
102102 }
103103
104- std::vector<FederationTxOut > tDepositsNew;
105- for (const FederationTxOut & tx_out : tDeposits) {
104+ std::vector<AnduroTxOut > tDepositsNew;
105+ for (const AnduroTxOut & tx_out : tDeposits) {
106106 if (tx_out.block_height == block_height) {
107107 tDepositsNew.push_back (tx_out);
108108 }
@@ -115,19 +115,19 @@ std::vector<FederationTxOut> listPendingDepositTransaction(uint32_t block_height
115115 * This function find total pegin amount for particular block
116116 */
117117CAmount listPendingDepositTotal (uint32_t block_height) {
118- std::vector<FederationTxOut > tDepositsNew;
118+ std::vector<AnduroTxOut > tDepositsNew;
119119 if (block_height == -1 ) {
120120 tDepositsNew = tDeposits;
121121 } else {
122- for (const FederationTxOut & tx_out : tDeposits) {
122+ for (const AnduroTxOut & tx_out : tDeposits) {
123123 if (tx_out.block_height == block_height) {
124124 tDepositsNew.push_back (tx_out);
125125 }
126126 }
127127 }
128128
129129 CAmount totalDeposit = CAmount (0 );
130- for (const FederationTxOut & txOut: tDepositsNew) {
130+ for (const AnduroTxOut & txOut: tDepositsNew) {
131131 totalDeposit = totalDeposit + CAmount (txOut.nValue );
132132 }
133133
@@ -138,17 +138,17 @@ CAmount listPendingDepositTotal(uint32_t block_height) {
138138 * Used to reset presigned signature for processed blocks
139139 */
140140void resetDeposit (uint32_t block_height) {
141- std::vector<FederationTxOut > tDepositsNew;
141+ std::vector<AnduroTxOut > tDepositsNew;
142142 bool hasDeposits = true ;
143143 uint32_t currentHeight = block_height;
144144 while (hasDeposits) {
145- for (const FederationTxOut & tx_out : tDeposits) {
145+ for (const AnduroTxOut & tx_out : tDeposits) {
146146 if (tx_out.block_height != block_height) {
147147 tDepositsNew.push_back (tx_out);
148148 }
149149 }
150150 currentHeight = currentHeight - 1 ;
151- std::vector<FederationTxOut > pending_deposits = listPendingDepositTransaction (currentHeight);
151+ std::vector<AnduroTxOut > pending_deposits = listPendingDepositTransaction (currentHeight);
152152 if (pending_deposits.size () == 0 ) {
153153 hasDeposits = false ;
154154 }
@@ -188,36 +188,36 @@ int32_t getNextIndex(ChainstateManager& chainman) {
188188}
189189
190190/* *
191- * Check block are fully synced to start validating federation new presigned signature for upcoming blocks
191+ * Check block are fully synced to start validating anduro new presigned signature for upcoming blocks
192192 */
193- bool isFederationValidationActive () {
193+ bool isAnduroValidationActive () {
194194 return isValidationActivate;
195195}
196196
197197/* *
198- * Validate the federation signature on confirmed blocks
198+ * Validate the anduro signature on confirmed blocks
199199 */
200- bool verifyFederation (ChainstateManager& chainman, const CBlock& block) {
200+ bool verifyAnduro (ChainstateManager& chainman, const CBlock& block) {
201201 LOCK (cs_main);
202202 CChain& active_chain = chainman.ActiveChain ();
203203 // activate presigned signature checker after blocks fully synced in node
204204 if (listPendingDepositTransaction (active_chain.Height ()+1 ).size ()>0 ) {
205205 isValidationActivate = true ;
206206 }
207207
208- if (!isFederationValidationActive ()) {
208+ if (!isAnduroValidationActive ()) {
209209 return true ;
210210 }
211211
212212 // check coinbase should have three output
213213 // 0 - fee reward for merge mine
214214 // 1 - coinbase message
215- // 2 - signature by previous block federation current keys
215+ // 2 - signature by previous block anduro current keys
216216 if (block.vtx [0 ]->vout .size () < 3 ) {
217217 return false ;
218218 }
219219
220- // check for current keys for federation
220+ // check for current keys for anduro
221221 CBlock prevblock;
222222 if (!ReadBlockFromDisk (prevblock, CHECK_NONFATAL (active_chain[active_chain.Height ()]), Params ().GetConsensus ())) {
223223 return false ;
@@ -235,17 +235,17 @@ bool verifyFederation(ChainstateManager& chainman, const CBlock& block) {
235235
236236 const std::string witnessStr = ScriptToAsmStr (witnessOut.scriptPubKey ).replace (0 ,10 ," " );
237237
238- std::vector<FederationTxOut > tOuts;
238+ std::vector<AnduroTxOut > tOuts;
239239 if (block.vtx [0 ]->vout .size () == 3 ) {
240240 const CTxDestination coinbaseScript = DecodeDestination (find_value (witnessVal.get_obj (), " current_address" ).get_str ());
241241 const CScript scriptPubKey = GetScriptForDestination (coinbaseScript);
242- FederationTxOut out (AmountFromValue (0 ), scriptPubKey, witnessStr, active_chain.Height () + 1 ,block.nextIndex ,block.currentKeys , " " , " " );
242+ AnduroTxOut out (AmountFromValue (0 ), scriptPubKey, witnessStr, active_chain.Height () + 1 ,block.nextIndex ,block.currentKeys , " " , " " );
243243 tOuts.push_back (out);
244244 } else {
245- // if more than 3 output in coinbase should be considered as pegin and recreating presigned signature for pegin to verify with federation current keys
245+ // if more than 3 output in coinbase should be considered as pegin and recreating presigned signature for pegin to verify with anduro current keys
246246 for (size_t i = 1 ; i < block.vtx [0 ]->vout .size ()-2 ; i=i+1 ) {
247247 CTxOut pegTx = block.vtx [0 ]->vout [i];
248- FederationTxOut out (pegTx.nValue , pegTx.scriptPubKey , witnessStr, active_chain.Height () + 1 ,block.nextIndex ,block.currentKeys , " " , " " );
248+ AnduroTxOut out (pegTx.nValue , pegTx.scriptPubKey , witnessStr, active_chain.Height () + 1 ,block.nextIndex ,block.currentKeys , " " , " " );
249249 tOuts.push_back (out);
250250 }
251251 }
0 commit comments