Test, use single array, dynamically sized for crosschain auth

This commit is contained in:
blackjok3r
2018-09-08 09:29:00 +08:00
parent 489eb6710d
commit b1a30161f0
2 changed files with 7 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
#include "cc/eval.h"
#include "crosschain.h"
#include "notarisationdb.h"
#include "komodo_notary.h"
int GetSymbolAuthority(const char* symbol)
@@ -51,27 +52,12 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth)
}
const char *notaries_STAKED[4][2] =
{
{"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"},
{"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"},
{"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"},
{"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}
};
/*
* TO EDIT:
* 1) Edit sigs above
* 2) Update size and requiredSigs below
*/
const CrosschainAuthority auth_STAKED = [&](){
CrosschainAuthority auth;
auth.size = 4;
auth.requiredSigs = 2;
auth.size = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED));
auth.requiredSigs = (auth.size/5);
for (int n=0; n<auth.size; n++)
for (size_t i=0; i<33; i++)
sscanf(notaries_STAKED[n][1]+(i*2), "%2hhx", auth.notaries[n]+i);
return auth;
}();

View File

@@ -198,13 +198,13 @@ const char *Notaries_elected1[][2] =
{"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" },
};
const char *Notaries_staked[][2] =
const char notaries_STAKED[][2] =
{
{"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"},
{"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"},
{"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"},
{"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"},
{"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" },
{"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" },
{"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60
{"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" },
{"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" },
@@ -242,9 +242,9 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
{
if ( strncmp("STAKED",ASSETCHAINS_SYMBOL,6) == 0 )
{
n1 = (int32_t)(sizeof(Notaries_staked)/sizeof(*Notaries_staked));
n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED));
for (i=0; i<n1; i++)
decode_hex(elected_pubkeys1[i],33,(char *)Notaries_staked[i][1]);
decode_hex(elected_pubkeys1[i],33,(char *)notaries_STAKED[i][1]);
did1 = 1;
printf("THIS CHAIN IS A STAKED CHAIN!\n");
}