Serialize effective amount #231

Closed
bvbfan wants to merge 309 commits from serialize_effective_amount into master
2 changed files with 27 additions and 0 deletions
Showing only changes of commit cddeccd2b9 - Show all commits

View file

@ -25,6 +25,29 @@ uint32_t vch_to_uint32_t(std::vector<unsigned char>& vchN)
return n; return n;
} }
CScript ClaimNameScript(std::string name, std::string value)
{
std::vector<unsigned char> vchName(name.begin(), name.end());
std::vector<unsigned char> vchValue(value.begin(), value.end());
return CScript() << OP_CLAIM_NAME << vchName << vchValue << OP_2DROP << OP_DROP << OP_TRUE;
}
CScript SupportClaimScript(std::string name, uint160 claimId)
{
std::vector<unsigned char> vchName(name.begin(), name.end());
std::vector<unsigned char> vchClaimId(claimId.begin(),claimId.end());
return CScript() << OP_SUPPORT_CLAIM << vchName << vchClaimId << OP_2DROP << OP_DROP << OP_TRUE;
}
CScript UpdateClaimScript(std::string name, uint160 claimId, std::string value)
{
std::vector<unsigned char> vchName(name.begin(), name.end());
std::vector<unsigned char> vchClaimId(claimId.begin(),claimId.end());
std::vector<unsigned char> vchValue(value.begin(), value.end());
return CScript() << OP_UPDATE_CLAIM << vchName << vchClaimId << vchValue << OP_2DROP << OP_2DROP << OP_TRUE;
}
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams) bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams)
{ {
CScript::const_iterator pc = scriptIn.begin(); CScript::const_iterator pc = scriptIn.begin();

View file

@ -14,6 +14,9 @@
// Scripts exceeding this size are rejected in CheckTransaction in main.cpp // Scripts exceeding this size are rejected in CheckTransaction in main.cpp
#define MAX_CLAIM_NAME_SIZE 255 #define MAX_CLAIM_NAME_SIZE 255
CScript ClaimNameScript(std::string name, std::string value);
CScript SupportClaimScript(std::string name, uint160 claimId);
CScript UpdateClaimScript(std::string name, uint160 claimId, std::string value);
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams); bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams);
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams, CScript::const_iterator& pc); bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams, CScript::const_iterator& pc);
CScript StripClaimScriptPrefix(const CScript& scriptIn); CScript StripClaimScriptPrefix(const CScript& scriptIn);
@ -26,4 +29,5 @@ size_t ClaimScriptSize(const CScript& scriptIn);
// get size of the name in a claim script, returns 0 if scriptin is not a claimetrie transaction // get size of the name in a claim script, returns 0 if scriptin is not a claimetrie transaction
size_t ClaimNameSize(const CScript& scriptIn); size_t ClaimNameSize(const CScript& scriptIn);
#endif // BITCOIN_NAMECLAIM_H #endif // BITCOIN_NAMECLAIM_H