diff --git a/src/main.cpp b/src/main.cpp index b3e31681c..f432eca29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1047,17 +1047,21 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - char notaryaddrs[num_notaries_STAKED1 + 1][64]; + static int32_t didinit; static char notaryaddrs[17 + 1][64]; int32_t i; - uint8_t pubkey33[33]; - for (i=0; i<=num_notaries_STAKED1; i++) - { - if ( i < num_notaries_STAKED1 ) - decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); - else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); - pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); - } - for (i=0; i<=num_notaries_STAKED1; i++) + if ( didinit == 0 ) + { + uint8_t pubkey33[33]; + for (i=0; i<=17; i++) + { + if ( i < 17 ) + decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); + else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); + pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); + } + didinit = 1; + } + for (i=0; i<=17; i++) if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) return(1); return(0);