Skip to content

Commit

Permalink
Adding publish stream testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank committed Feb 24, 2018
1 parent f45fffa commit a8538dc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/rpc/rpcstreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,7 @@ Value publishfrom(const Array& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid item-key-string: *");
}

mc_Script *lpScript=mc_gState->m_TmpBuffers->m_RpcScript3;
lpScript->Clear();
mc_Script *lpScript;
mc_EntityDetails stream_entity;
parseStreamIdentifier(params[1],&stream_entity);

Expand Down Expand Up @@ -575,8 +574,8 @@ Value publishfrom(const Array& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Item key is too long");
}

mc_Script *lpDetailsScript=mc_gState->m_TmpBuffers->m_RpcScript1;
lpDetailsScript->Clear();
mc_Script *lpDetailsScript;
lpDetailsScript=NULL;


bool fIsHex;
Expand All @@ -586,7 +585,7 @@ Value publishfrom(const Array& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Item data should be hexadecimal string");
}

lpDetailsScript->Clear();
lpDetailsScript=new mc_Script;
lpDetailsScript->SetEntity(stream_entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET);
lpDetailsScript->SetItemKey((unsigned char*)params[2].get_str().c_str(),params[2].get_str().size());

Expand Down Expand Up @@ -624,14 +623,17 @@ Value publishfrom(const Array& params, bool fHelp)
}


lpScript->Clear();
lpScript=new mc_Script;

EnsureWalletIsUnlocked();
LOCK (pwalletMain->cs_wallet_send);

SendMoneyToSeveralAddresses(addresses, 0, wtx, lpScript, scriptOpReturn,fromaddresses);

return wtx.GetHash().GetHex();
delete lpDetailsScript;
delete lpScript;

return wtx.GetHash().GetHex();
}

Value subscribe(const Array& params, bool fHelp)
Expand Down

0 comments on commit a8538dc

Please sign in to comment.