Test
This commit is contained in:
@@ -198,6 +198,14 @@ bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
||||||
|
{
|
||||||
|
std::vector<uint8_t>pk; int32_t i;
|
||||||
|
for (i=0; i<33; i++)
|
||||||
|
pk.push_back(pubkey33[i]);
|
||||||
|
return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG));
|
||||||
|
}
|
||||||
|
|
||||||
CPubKey CCtxidaddr(char *txidaddr,uint256 txid)
|
CPubKey CCtxidaddr(char *txidaddr,uint256 txid)
|
||||||
{
|
{
|
||||||
uint8_t buf33[33]; CPubKey pk;
|
uint8_t buf33[33]; CPubKey pk;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ uint64_t komodo_paxtotal();
|
|||||||
int32_t komodo_longestchain();
|
int32_t komodo_longestchain();
|
||||||
uint64_t komodo_maxallowed(int32_t baseid);
|
uint64_t komodo_maxallowed(int32_t baseid);
|
||||||
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
|
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
|
||||||
|
bool pubkey2addr(char *destaddr,uint8_t *pubkey33);
|
||||||
|
|
||||||
pthread_mutex_t komodo_mutex;
|
pthread_mutex_t komodo_mutex;
|
||||||
|
|
||||||
|
|||||||
@@ -199,20 +199,24 @@ const char *Notaries_elected1[][2] =
|
|||||||
};
|
};
|
||||||
#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
|
#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
|
||||||
|
|
||||||
int32_t komodo_isnotaryvout(uint8_t *script) // from ac_private chains only
|
int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only
|
||||||
{
|
{
|
||||||
uint8_t pubkey33[33]; int32_t i;
|
static int32_t didinit; static char notaryaddrs[65][64];
|
||||||
if ( script[0] == 33 && script[34] == 0xac )
|
if ( didinit == 0 )
|
||||||
{
|
{
|
||||||
|
uint8_t pubkey33[33];
|
||||||
for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++)
|
for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++)
|
||||||
{
|
{
|
||||||
if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) )
|
if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) )
|
||||||
decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]);
|
decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]);
|
||||||
else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR);
|
else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR);
|
||||||
if ( memcmp(script+1,pubkey33,33) == 0 )
|
pubkey2addr(notaryaddrs[i],pubkey33);
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
|
didinit = 1;
|
||||||
}
|
}
|
||||||
|
for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++)
|
||||||
|
if ( strcmp(coinaddr,notaryaddrs[i]) == 0 )
|
||||||
|
return(1);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_INSYNC,KOMODO_CON
|
|||||||
int32_t KOMODO_NEWBLOCKS;
|
int32_t KOMODO_NEWBLOCKS;
|
||||||
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||||
void komodo_broadcast(CBlock *pblock,int32_t limit);
|
void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||||
int32_t komodo_isnotaryvout(CScript scriptPubKey);
|
int32_t komodo_isnotaryvout(char *destaddr);
|
||||||
|
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||||
|
|
||||||
BlockMap mapBlockIndex;
|
BlockMap mapBlockIndex;
|
||||||
CChain chainActive;
|
CChain chainActive;
|
||||||
@@ -1121,7 +1122,9 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
|
|||||||
//fprintf(stderr,"private chain nValue %.8f iscoinbase.%d\n",(double)txout.nValue/COIN,iscoinbase);
|
//fprintf(stderr,"private chain nValue %.8f iscoinbase.%d\n",(double)txout.nValue/COIN,iscoinbase);
|
||||||
if ( (txout.nValue > 0 && iscoinbase == 0) || tx.GetJoinSplitValueOut() > 0 )
|
if ( (txout.nValue > 0 && iscoinbase == 0) || tx.GetJoinSplitValueOut() > 0 )
|
||||||
{
|
{
|
||||||
if ( txout.scriptPubKey.size() == 35 && komodo_isnotaryvout((uint8_t *)txout.scriptPubKey.data()) == 0 )
|
char destaddr[65];
|
||||||
|
Getscriptaddress(destaddr,txout.scriptPubKey);
|
||||||
|
if ( komodo_isnotaryvout(destaddr) == 0 )
|
||||||
return state.DoS(100, error("CheckTransaction(): this is a private chain, no public allowed"),REJECT_INVALID, "bad-txns-acprivacy-chain");
|
return state.DoS(100, error("CheckTransaction(): this is a private chain, no public allowed"),REJECT_INVALID, "bad-txns-acprivacy-chain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user