message: Moved the locks in sendtocontract and createcontract to avoid race condition with the dgp call
diff: @@ -446,6 +446,7 @@ UniValue createcontract(const JSONRPCRequest& request){
  if (!EnsureWalletIsAvailable(request.fHelp))
  return NullUniValue;
  + LOCK2(cs_main, pwalletMain->cs_wallet);
  QtumDGP qtumDGP(globalState.get(), fGettingValuesDGP);
  uint64_t blockGasLimit = qtumDGP.getBlockGasLimit(chainActive.Height());
  uint64_t minGasPrice = CAmount(qtumDGP.getMinGasPrice(chainActive.Height()));
  @@ -477,7 +478,6 @@ UniValue createcontract(const JSONRPCRequest& request){
  + HelpExampleCli("createcontract", "\"60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690836c010000000000000000000000009081020402179055506103786001600050819055505b600c80605b6000396000f360606040526008565b600256\" 6000000 "+FormatMoney(minGasPrice)+" \"QM72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" true")
  );
  - LOCK2(cs_main, pwalletMain->cs_wallet);
  string bytecode=request.params[0].get_str();
  @@ -648,6 +648,7 @@ UniValue sendtocontract(const JSONRPCRequest& request){
  if (!EnsureWalletIsAvailable(request.fHelp))
  return NullUniValue;
  + LOCK2(cs_main, pwalletMain->cs_wallet);
  QtumDGP qtumDGP(globalState.get(), fGettingValuesDGP);
  uint64_t blockGasLimit = qtumDGP.getBlockGasLimit(chainActive.Height());
  uint64_t minGasPrice = CAmount(qtumDGP.getMinGasPrice(chainActive.Height()));
  @@ -680,7 +681,6 @@ UniValue sendtocontract(const JSONRPCRequest& request){
  + HelpExampleCli("sendtocontract", "\"c6ca2697719d00446d4ea51f6fac8fd1e9310214\" \"54f6127f\" 12.0015 6000000 "+FormatMoney(minGasPrice)+" \"QM72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"")
  );
  - LOCK2(cs_main, pwalletMain->cs_wallet);
  std::string contractaddress = request.params[0].get_str();
  if(contractaddress.size() != 40 || !CheckHex(contractaddress))
  