// if we passed no prior notarizations, the crosstxid returned can be null
if ((!uv1.isStr() && (cnd.vtx.size() != 0)) || !uv2.isStr() || !uv3.isStr() || !uv4.isStr())
{
+ printf("%sinvalid parameters\n", funcname);
return false;
}
if (crossNotarizationID.IsNull() || !DecodeHexTx(crossTx, uv3.get_str()))
{
+ printf("%sinvalid parameters 2\n", funcname);
return false;
}
if (crossNotarizaton.prevNotarization.IsNull() && !chainDef.IsValid())
{
// must either have a prior notarization or be the definition
+ printf("%sNo prior notarization and no chain definition in cross notarization\n", funcname);
return false;
}
if (pbn.prevHeight + CPBaaSNotarization::MIN_BLOCKS_BETWEEN_ACCEPTED > pbn.notarizationHeight)
{
// can't make another notarization yet
+ printf("%sNot enough blocks to notarize - prevHeight.%d, notarizationHeight.%d\n", funcname, pbn.prevHeight, pbn.notarizationHeight);
return false;
}
}
pbn.nodes.erase(pbn.nodes.begin() + toErase);
}
- //TODO: UNCOMMENT
- //CScript opRet = StoreOpRetArray(chainObjects);
+ CScript opRet = StoreOpRetArray(chainObjects);
// we are ready to create a transaction to send to the other chain
vKeys.push_back(CTxDestination(CKeyID(CCrossChainRPCData::GetConditionID(ASSETCHAINS_CHAINID, EVAL_ACCEPTEDNOTARIZATION))));
mnewTx.vout.push_back(MakeCC1of1Vout(EVAL_ACCEPTEDNOTARIZATION, PBAAS_MINNOTARIZATIONOUTPUT, pk, vKeys, pbn));
- // TODO: UNCOMMENT make opret output
- //mnewTx.vout.push_back(CTxOut(0, opRet));
+ mnewTx.vout.push_back(CTxOut(0, opRet));
// finish transaction by sending it to the other notary chain for completion and submission
CTransaction notarization(mnewTx);
CTransaction notarization;
CPBaaSNotarization pbn;
- /*
if (!DecodeHexTx(notarization, params[0].get_str()) ||
notarization.vin.size() ||
notarization.vout.size() != 2 ||
{
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid notarization transaction");
}
- */
- // debugging leniency, no op_return
- if (!DecodeHexTx(notarization, params[0].get_str()) ||
- notarization.vin.size() ||
- notarization.vout.size() != 1 ||
- !(pbn = CPBaaSNotarization(notarization)).IsValid())
- {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid notarization transaction");
- }
// ensure we are still eligible to submit
// finalize all transactions we can and send the notarization reward, plus all orphaned finalization outputs
// printf("opRet: %s\n", notarization.vout[notarization.vout.size() - 1].scriptPubKey.ToString().c_str());
- // TODO: uncomment
- /*
auto chainObjects = RetrieveOpRetArray(notarization.vout[notarization.vout.size() - 1].scriptPubKey);
bool stillValid = false;
printf("Notarization heights not matched with previous notarization");
throw JSONRPCError(RPC_VERIFY_REJECTED, "Notarization heights not matched with previous notarization");
}
- */
if (pbn.prevHeight != 0 && (pbn.prevHeight + CPBaaSNotarization::MIN_BLOCKS_BETWEEN_ACCEPTED > pbn.notarizationHeight))
{
dests = std::vector<CTxDestination>({CKeyID(CCrossChainRPCData::GetConditionID(pbn.chainID, EVAL_FINALIZENOTARIZATION))});
CNotarizationFinalization nf(confirmedInput);
- // TODO UNCOMMENT:
- //mnewTx.vout.insert(mnewTx.vout.begin() + (mnewTx.vout.size() - 1), MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
- mnewTx.vout.insert(mnewTx.vout.begin() + 1, MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
+
+ mnewTx.vout.insert(mnewTx.vout.begin() + (mnewTx.vout.size() - 1), MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
}
if (notarizationInputs.size() && GetNotarizationAndFinalization(EVAL_ACCEPTEDNOTARIZATION, mnewTx, dummy, ¬arizationIdx, &finalizationIdx))