Fix p2pkh check
This commit is contained in:
@@ -1478,7 +1478,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
|
||||
|
||||
int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
|
||||
{
|
||||
int64_t checktoshis=0; uint8_t *script;
|
||||
int64_t checktoshis=0; uint8_t *script; int32_t scriptlen,matched = 0;
|
||||
if ( ASSETCHAINS_COMMISSION != 0 )
|
||||
{
|
||||
checktoshis = komodo_commission(pblock,height);
|
||||
@@ -1488,10 +1488,16 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
|
||||
else*/ if ( checktoshis != 0 )
|
||||
{
|
||||
script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data();
|
||||
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
|
||||
scriptlen = (int32_t)pblock->vtx[0].vout[1].scriptPubKey.size();
|
||||
if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) == 0 )
|
||||
matched = 1;
|
||||
else if ( scriptlen == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 && script[23] == OP_EQUALVERIFY && script[24] == OP_CHECKSIG && memcmp(script+2,ASSETCHAINS_OVERRIDE_PUBKEYHASH,20) == 0 )
|
||||
matched = 2;
|
||||
if ( matched == 0 )
|
||||
{
|
||||
if ( script[0] != 25 || script[0] != OP_DUP || script[1] != OP_HASH160 || script[23] != OP_EQUALVERIFY || script[24] != OP_CHECKSIG || memcmp(script+2,ASSETCHAINS_OVERRIDE_PUBKEYHASH,20) != 0 )
|
||||
fprintf(stderr,"payment to wrong pubkey\n");
|
||||
return(-1);
|
||||
|
||||
}
|
||||
if ( pblock->vtx[0].vout[1].nValue != checktoshis )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user