Raw script

This commit is contained in:
jl777
2019-07-10 21:56:28 -11:00
parent 3a50d1a9b9
commit 1fd0425265
2 changed files with 8 additions and 4 deletions

View File

@@ -299,7 +299,7 @@ std::string NSPV_signtx(int64_t &rewardsum,int64_t &interestsum,UniValue &retcod
UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its all about! UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its all about!
{ {
UniValue result(UniValue::VOBJ),retcodes(UniValue::VARR); std::vector<uint8_t> data; CScript scriptPubKey; uint8_t rmd160[128]; int64_t txfee = 10000; UniValue result(UniValue::VOBJ),retcodes(UniValue::VARR); CScript scriptPubKey; uint8_t *data,rmd160[128]; int32_t len; int64_t txfee = 10000;
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT ) if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
{ {
result.push_back(Pair("result","error")); result.push_back(Pair("result","error"));
@@ -315,8 +315,13 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
} }
else if ( bitcoin_base58decode(rmd160,destaddr) != 25 ) else if ( bitcoin_base58decode(rmd160,destaddr) != 25 )
{ {
if ( is_hexstr(destaddr,0) > 0 ) if ( (len= is_hexstr(destaddr,0)) > 0 )
scriptPubKey = CScript() << ParseHex(destaddr); {
len >>= 1;
scriptPubKey.resize(len);
data = (uint8_t *)scriptPubKey.begin();
decode_hex(data,len,destaddr);
}
else else
{ {
result.push_back(Pair("result","error")); result.push_back(Pair("result","error"));

View File

@@ -2224,7 +2224,6 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
{ {
int64_t rewardsum = 0; int32_t retval,vout = 0; int64_t rewardsum = 0; int32_t retval,vout = 0;
retval = NSPV_gettransaction(1,vout,hash,0,txOut,0,0,rewardsum); retval = NSPV_gettransaction(1,vout,hash,0,txOut,0,0,rewardsum);
fprintf(stderr,"myGetTransaction retval.%d\n",retval);
return(retval == 0); return(retval == 0);
} }
// need a GetTransaction without lock so the validation code for assets can run without deadlock // need a GetTransaction without lock so the validation code for assets can run without deadlock