lev deser restored

This commit is contained in:
dimxy
2019-04-23 15:40:50 +05:00
parent 7e312afc9e
commit f0f091ba0a
+2 -7
View File
@@ -60,21 +60,16 @@ CScript prices_betopret(CPubKey mypk,int32_t height,int64_t amount,int16_t lever
{ {
CScript opret; CScript opret;
opret << OP_RETURN << E_MARSHAL(ss << EVAL_PRICES << 'B' << mypk << height << amount << leverage << firstprice << vec << tokenid); opret << OP_RETURN << E_MARSHAL(ss << EVAL_PRICES << 'B' << mypk << height << amount << leverage << firstprice << vec << tokenid);
std::cerr << "prices_betopret() leverage=" << leverage << std::endl;
return(opret); return(opret);
} }
uint8_t prices_betopretdecode(CScript scriptPubKey,CPubKey &pk,int32_t &height,int64_t &amount,int16_t &leverage,int64_t &firstprice,std::vector<uint16_t> &vec,uint256 &tokenid) uint8_t prices_betopretdecode(CScript scriptPubKey,CPubKey &pk,int32_t &height,int64_t &amount,int16_t &leverage,int64_t &firstprice,std::vector<uint16_t> &vec,uint256 &tokenid)
{ {
std::vector<uint8_t> vopret; uint8_t e,f; std::vector<uint8_t> vopret; uint8_t e,f;
unsigned char u, l;
GetOpReturnData(scriptPubKey,vopret); GetOpReturnData(scriptPubKey,vopret);
if (vopret.size() > 2 && E_UNMARSHAL(vopret, ss >> e; ss >> f; ss >> pk; ss >> height; ss >> amount; ss >> l; ss >> u; ss >> firstprice; ss >> vec; ss >> tokenid) != 0 && e == EVAL_PRICES && f == 'B') if (vopret.size() > 2 && E_UNMARSHAL(vopret, ss >> e; ss >> f; ss >> pk; ss >> height; ss >> amount; ss >> leverage; ss >> firstprice; ss >> vec; ss >> tokenid) != 0 && e == EVAL_PRICES && f == 'B')
{ {
unsigned char *p = (unsigned char*)&leverage;
*p = l;
*(p + 1) = u;
std::cerr << "prices_betopretdecode() leverage=" << leverage << std::endl;
return(f); return(f);
} }
return(0); return(0);