corr DecodeHeirEitherOpRet call in LifeTimeHeirContractFund
restores !ismempool.. check
This commit is contained in:
@@ -593,14 +593,14 @@ template <class Helper> int64_t Add1of2AddressInputs(struct CCcontract_info* cp,
|
|||||||
uint8_t hasHeirSpendingBegunDummy;
|
uint8_t hasHeirSpendingBegunDummy;
|
||||||
std::vector<CPubKey> vinPubkeysEmpty;
|
std::vector<CPubKey> vinPubkeysEmpty;
|
||||||
|
|
||||||
CScript heirScript = (heirtx.vout.size() > 0) ? heirtx.vout[heirtx.vout.size() - 1].scriptPubKey : CScript();
|
CScript heirScript = (heirtx.vout.size() > 0) ? heirtx.vout[heirtx.vout.size() - 1].scriptPubKey : CScript(); // check boundary
|
||||||
uint8_t funcId = DecodeHeirEitherOpRet(heirScript, tokenid, fundingTxidInOpret, hasHeirSpendingBegunDummy, false);
|
uint8_t funcId = DecodeHeirEitherOpRet(heirScript, tokenid, fundingTxidInOpret, hasHeirSpendingBegunDummy, false);
|
||||||
|
|
||||||
if ((txid == fundingtxid || fundingTxidInOpret == fundingtxid) &&
|
if ((txid == fundingtxid || fundingTxidInOpret == fundingtxid) &&
|
||||||
funcId != 0 &&
|
funcId != 0 &&
|
||||||
isMyFuncId(funcId) &&
|
isMyFuncId(funcId) &&
|
||||||
(typeid(Helper) == typeid(TokenHelper) && IsTokensvout(true, true, cp, nullptr, heirtx, voutIndex, tokenid, vinPubkeysEmpty) > 0) && // deep validation for tokens - not used anymore
|
(typeid(Helper) != typeid(TokenHelper) || IsTokensvout(true, true, cp, nullptr, heirtx, voutIndex, tokenid, vinPubkeysEmpty) > 0) && // token validation logic
|
||||||
(voutValue = IsHeirFundingVout<Helper>(cp, heirtx, voutIndex, ownerPubkey, heirPubkey)) > 0 &&
|
//(voutValue = IsHeirFundingVout<Helper>(cp, heirtx, voutIndex, ownerPubkey, heirPubkey)) > 0 && // heir contract vout validation logic - not used since we moved to 2-eval vouts
|
||||||
!myIsutxo_spentinmempool(txid, voutIndex))
|
!myIsutxo_spentinmempool(txid, voutIndex))
|
||||||
{
|
{
|
||||||
std::cerr << "Add1of2AddressInputs() voutValue=" << voutValue << " satoshis=" << it->second.satoshis << '\n';
|
std::cerr << "Add1of2AddressInputs() voutValue=" << voutValue << " satoshis=" << it->second.satoshis << '\n';
|
||||||
@@ -633,28 +633,26 @@ template <class Helper> int64_t LifetimeHeirContractFunds(struct CCcontract_info
|
|||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount>>::const_iterator it = addressIndexes.begin(); it != addressIndexes.end(); it++) {
|
for (std::vector<std::pair<CAddressIndexKey, CAmount>>::const_iterator it = addressIndexes.begin(); it != addressIndexes.end(); it++) {
|
||||||
uint256 hashBlock;
|
uint256 hashBlock;
|
||||||
uint256 txid = it->first.txhash;
|
uint256 txid = it->first.txhash;
|
||||||
CTransaction tx;
|
CTransaction heirtx;
|
||||||
|
|
||||||
if (GetTransaction(txid, tx, hashBlock, false) && tx.vout.size() > 0) {
|
// TODO: check all funding tx should contain unspendable markers
|
||||||
uint8_t evalCodeTokens = 0;
|
if (GetTransaction(txid, heirtx, hashBlock, false) && heirtx.vout.size() > 0) {
|
||||||
uint256 tokenid;
|
uint256 tokenid;
|
||||||
uint256 fundingTxidInOpret;
|
uint256 fundingTxidInOpret;
|
||||||
std::vector<uint8_t> vopretExtra;
|
uint8_t hasHeirSpendingBegunDummy;
|
||||||
std::vector<CPubKey> voutPubkeys;
|
std::vector<CPubKey> vinPubkeysEmpty;
|
||||||
uint8_t dummyHasHeirSpendingBegun;
|
|
||||||
const int32_t ivout = 0;
|
const int32_t ivout = 0;
|
||||||
|
|
||||||
CScript heirScript = tx.vout[tx.vout.size() - 1].scriptPubKey;
|
CScript heirScript = (heirtx.vout.size() > 0) ? heirtx.vout[heirtx.vout.size() - 1].scriptPubKey : CScript(); // check boundary
|
||||||
uint8_t funcId = DecodeTokenOpRet(heirScript, evalCodeTokens, tokenid, voutPubkeys, vopretExtra);
|
uint8_t funcId = DecodeHeirEitherOpRet(heirScript, tokenid, fundingTxidInOpret, hasHeirSpendingBegunDummy, false);
|
||||||
if (funcId != 0) {
|
|
||||||
heirScript = CScript(vopretExtra);
|
|
||||||
}
|
|
||||||
funcId = DecodeHeirOpRet(heirScript, fundingTxidInOpret, dummyHasHeirSpendingBegun, true);
|
|
||||||
|
|
||||||
//std::cerr << "LifetimeHeirContractFunds() found tx=" << txid.GetHex() << " vout[0].nValue=" << subtx.vout[ccVoutIdx].nValue << " opreturn=" << (char)funcId << '\n';
|
//std::cerr << "LifetimeHeirContractFunds() found tx=" << txid.GetHex() << " vout[0].nValue=" << subtx.vout[ccVoutIdx].nValue << " opreturn=" << (char)funcId << '\n';
|
||||||
|
|
||||||
if (funcId != 0 && (txid == fundingtxid || fundingTxidInOpret == fundingtxid) && isMyFuncId(funcId) && !isSpendingTx(funcId)
|
if (funcId != 0 &&
|
||||||
/* && !myIsutxo_spentinmempool(txid, ccVoutIdx) */) // include also tx in mempool
|
(txid == fundingtxid || fundingTxidInOpret == fundingtxid) &&
|
||||||
|
isMyFuncId(funcId) && !isSpendingTx(funcId) &&
|
||||||
|
(typeid(Helper) != typeid(TokenHelper) || IsTokensvout(true, true, cp, nullptr, heirtx, ivout, tokenid, vinPubkeysEmpty) > 0) &&
|
||||||
|
!myIsutxo_spentinmempool(txid, ivout)) // exclude tx in mempool
|
||||||
{
|
{
|
||||||
total += it->second; // dont do this: tx.vout[ivout].nValue; // in vin[0] always is the pay to 1of2 addr (funding or change)
|
total += it->second; // dont do this: tx.vout[ivout].nValue; // in vin[0] always is the pay to 1of2 addr (funding or change)
|
||||||
//std::cerr << "LifetimeHeirContractFunds() added tx=" << txid.GetHex() << " it->second=" << it->second << " vout[0].nValue=" << tx.vout[ivout].nValue << " opreturn=" << (char)funcId << '\n';
|
//std::cerr << "LifetimeHeirContractFunds() added tx=" << txid.GetHex() << " it->second=" << it->second << " vout[0].nValue=" << tx.vout[ivout].nValue << " opreturn=" << (char)funcId << '\n';
|
||||||
|
|||||||
Reference in New Issue
Block a user