Added time lock transaction creation and verification
This commit is contained in:
@@ -61,8 +61,8 @@ uint64_t ASSETCHAINS_COMMISSION;
|
|||||||
int64_t ASSETCHAINS_TIMELOCKGTE = _ASSETCHAINS_TIMELOCKOFF;
|
int64_t ASSETCHAINS_TIMELOCKGTE = _ASSETCHAINS_TIMELOCKOFF;
|
||||||
uint64_t ASSETCHAINS_TIMEUNLOCKFROM = 0;
|
uint64_t ASSETCHAINS_TIMEUNLOCKFROM = 0;
|
||||||
uint64_t ASSETCHAINS_TIMEUNLOCKTO = 0;
|
uint64_t ASSETCHAINS_TIMEUNLOCKTO = 0;
|
||||||
uint8_t OPRETTYPE_COINBASETIMELOCK = 1;
|
#define OPRETTYPE_COINBASETIMELOCK = 1;
|
||||||
uint8_t OPRETTYPE_REDEEMSCRIPT = 2;
|
#define OPRETTYPE_REDEEMSCRIPT = 2;
|
||||||
|
|
||||||
uint32_t ASSETCHAINS_ERAS = 1;
|
uint32_t ASSETCHAINS_ERAS = 1;
|
||||||
uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS];
|
uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS];
|
||||||
|
|||||||
@@ -918,9 +918,9 @@ bool ContextualCheckCoinbaseTransaction(const CTransaction& tx, const int nHeigh
|
|||||||
if (tx.vout.size() != 2 ||
|
if (tx.vout.size() != 2 ||
|
||||||
tx.vout[1].scriptPubKey.size() < 4 || // minimum for any possible future to prevent out of bounds
|
tx.vout[1].scriptPubKey.size() < 4 || // minimum for any possible future to prevent out of bounds
|
||||||
tx.vout[1].scriptPubKey.data()[0] != SCRIPT_OP_RETURN ||
|
tx.vout[1].scriptPubKey.data()[0] != SCRIPT_OP_RETURN ||
|
||||||
tx.vout[0].scriptPubKey.size() < 22 ||
|
tx.vout[0].scriptPubKey.size() != 22 ||
|
||||||
*(uint8_t *)(tx.vout[0].scriptPubKey.data()) != 20 ||
|
*(uint8_t *)(tx.vout[0].scriptPubKey.data()) != 20 ||
|
||||||
*(uint8_t *)((tx.vout[0].scriptPubKey.data()) + 21) != SCRIPT_OP_EQUAL)
|
((uint8_t *)(tx.vout[0].scriptPubKey.data()))[21] != SCRIPT_OP_EQUAL)
|
||||||
i = 0;
|
i = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -937,8 +937,9 @@ bool ContextualCheckCoinbaseTransaction(const CTransaction& tx, const int nHeigh
|
|||||||
}
|
}
|
||||||
else if (tx.vout[1].scriptPubKey.data()[2] == OPRETTYPE_REDEEMSCRIPT && i >= 23 && i < sizeof(script))
|
else if (tx.vout[1].scriptPubKey.data()[2] == OPRETTYPE_REDEEMSCRIPT && i >= 23 && i < sizeof(script))
|
||||||
{
|
{
|
||||||
i -= 1;
|
memcpy(script, ((uint8_t *)tx.vout[1].scriptPubKey.data())[i < SCRIPT_OP_PUSH1 ? 3 : i > SCRIPT_OP_PUSH1 ? 5 : 4]), i - 1);
|
||||||
memcpy(script, (uint8_t *)tx.vout[1].scriptPubKey.data()+3, i);
|
// decrement after the prior call in case of optimization side effects
|
||||||
|
i--;
|
||||||
calc_rmd160_sha256(scriptHash, script, i);
|
calc_rmd160_sha256(scriptHash, script, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user