Value getdata(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"getdata \n"
"Returns base64 data from a given tx-hash.");
std::string strHash = params[0].get_str();
uint256 hash(strHash);
CTransaction tx;
uint256 hashBlock = 0;
if (!GetTransaction(hash, tx, hashBlock, true))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction");
string data = tx.GetBase64Data();
return data;
}
From bitcoin documentation.
https://chainquery.com/bitcoin-api/gettransactionCommand: gettransaction
Notes: The gettransaction RPC gets detailed information about an in-wallet transaction.
....
Note
Only transactions for this wallet are shown, for other transactions try getrawtransaction.
It seems the GetTransaction function must be correctly replaced with getrawtransaction function.