Fix out type

This commit is contained in:
jl777
2018-07-21 03:56:57 -11:00
parent fa62690da2
commit e512c055ac
2 changed files with 7 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
fprintf(stderr,"extractdestinations error\n");
out.push_back(Pair("type", GetTxnOutputType(type))); out.push_back(Pair("type", GetTxnOutputType(type)));
return; return;
} }

View File

@@ -31,6 +31,8 @@ const char* GetTxnOutputType(txnouttype t)
case TX_SCRIPTHASH: return "scripthash"; case TX_SCRIPTHASH: return "scripthash";
case TX_MULTISIG: return "multisig"; case TX_MULTISIG: return "multisig";
case TX_NULL_DATA: return "nulldata"; case TX_NULL_DATA: return "nulldata";
case TX_CRYPTOCONDITION: return "cryptocondition";
default: return "invalid";
} }
return NULL; return NULL;
} }
@@ -260,7 +262,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
return true; return true;
} }
else if ( whichType == TX_CRYPTOCONDITION) else if (IsCryptoConditionsEnabled() != 0 && whichType == TX_CRYPTOCONDITION)
{ {
fprintf(stderr,"found CC type\n"); fprintf(stderr,"found CC type\n");
addressRet = CScriptID(uint160(vSolutions[0])); addressRet = CScriptID(uint160(vSolutions[0]));
@@ -303,7 +305,10 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
nRequiredRet = 1; nRequiredRet = 1;
CTxDestination address; CTxDestination address;
if (!ExtractDestination(scriptPubKey, address)) if (!ExtractDestination(scriptPubKey, address))
{
fprintf(stderr,"error extractdestination from extractdestinations\n");
return false; return false;
}
addressRet.push_back(address); addressRet.push_back(address);
} }