More work on CoinbaseGuard and validation

This commit is contained in:
miketout
2018-10-03 16:26:41 -07:00
parent aa3ce4242f
commit 905fe35e50
8 changed files with 224 additions and 53 deletions

View File

@@ -91,34 +91,19 @@ class COptCCParams
uint8_t version;
uint8_t evalCode;
uint8_t m, n; // for m of n sigs required, n pub keys for sigs will follow
std::vector<CPubKey> vKeys; // n public keys to aid in signing
std::vector<std::vector<unsigned char>> vData; // extra parameters
COptCCParams() : version(0), evalCode(0), n(0), m(0) {}
COptCCParams(uint8_t ver, uint8_t code, uint8_t _n, uint8_t _m) : version(ver), evalCode(code), n(_n), m(_m) {}
COptCCParams(uint8_t ver, uint8_t code, uint8_t _n, uint8_t _m, std::vector<CPubKey> &vkeys, std::vector<std::vector<unsigned char>> &vdata) :
version(ver), evalCode(code), n(_n), m(_m), vKeys(vkeys), vData(vdata) {}
COptCCParams(std::vector<unsigned char> &vch)
{
version = 0;
if (vch.size() == 4)
{
version = vch[0];
evalCode = vch[1];
n = vch[2];
m = vch[3];
if (version != VERSION && m == 1 && (n == 1 || n == 2))
{
// we only support one version, and 1 of 1 or 1 of 2 now, so set invalid
version = 0;
}
}
}
COptCCParams(std::vector<unsigned char> &vch);
bool IsValid() { return version != 0; }
std::vector<unsigned char> AsVector()
{
std::vector<unsigned char> vch = std::vector<unsigned char>({version, evalCode, n, m});
}
std::vector<unsigned char> AsVector();
};
/** Check whether a CTxDestination is a CNoDestination. */