Skip to content

Commit

Permalink
Merge pull request qtumproject#629 from qtumproject/neil/fix-contract…
Browse files Browse the repository at this point in the history
…-rpc-p2sh-bug

Disallow P2SH addresses as sender in contract rpc calls
  • Loading branch information
qtum-neil authored Nov 21, 2018
2 parents 75cd02c + 3f97025 commit 3764bf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ UniValue createcontract(const JSONRPCRequest& request){
senderAddress = DecodeDestination(request.params[3].get_str());
if (!IsValidDestination(senderAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Qtum address to send from");
if (!IsValidContractSenderAddress(senderAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid contract sender address. Only P2PK and P2PKH allowed");
else
fHasSender=true;
}
Expand Down Expand Up @@ -881,6 +883,8 @@ UniValue sendtocontract(const JSONRPCRequest& request){
senderAddress = DecodeDestination(request.params[5].get_str());
if (!IsValidDestination(senderAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Qtum address to send from");
if (!IsValidContractSenderAddress(senderAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid contract sender address. Only P2PK and P2PKH allowed");
else
fHasSender=true;
}
Expand Down

0 comments on commit 3764bf8

Please sign in to comment.