This commit is contained in:
jl777
2016-10-21 16:44:49 -03:00
parent 2fe65b37f5
commit 8a9bc02778
5 changed files with 31 additions and 25 deletions

View File

@@ -322,6 +322,11 @@ vector<unsigned char> ParseHexUO(map<string,UniValue>& o, string strKey)
return ParseHexUV(o[strKey], strKey);
}
uint32_t komodo_txtime(uint256 hash)
{
return(0);
}
static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
{
int nHashType = SIGHASH_ALL;

View File

@@ -383,28 +383,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
return coins->vout[input.prevout.n].scriptPubKey;
}
uint32_t komodo_txtime(uint256 hash)
{
CTransaction tx;
uint256 hashBlock;
if (!GetTransaction(hash, tx, hashBlock, true))
{
//printf("null GetTransaction\n");
return(tx.nLockTime);
}
if (!hashBlock.IsNull()) {
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
if (chainActive.Contains(pindex))
return(pindex->GetBlockTime());
}
//printf("cant find in iterator\n");
}
//printf("null hashBlock\n");
return(tx.nLockTime);
}
uint32_t komodo_txtime(uint256 hash);
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx,uint32_t blocktime) const
{

View File

@@ -37,7 +37,6 @@ struct knotaries_entry { int32_t height,numnotaries; struct knotary_entry *Notar
struct notarized_checkpoint { uint256 notarized_hash,notarized_btctxid; int32_t nHeight,notarized_height; } *NPOINTS; int32_t NUM_NPOINTS;
int32_t komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts);
uint32_t komodo_txtime(uint256 hash);
// add opreturn funcid
// pricefeeds
@@ -247,6 +246,29 @@ int32_t komodo_threshold(int32_t height,uint64_t signedmask)
else return(0);
}
uint32_t komodo_txtime(uint256 hash)
{
CTransaction tx;
uint256 hashBlock;
if (!GetTransaction(hash, tx, hashBlock, true))
{
//printf("null GetTransaction\n");
return(tx.nLockTime);
}
if (!hashBlock.IsNull()) {
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
if (chainActive.Contains(pindex))
return(pindex->GetBlockTime());
}
//printf("cant find in iterator\n");
}
//printf("null hashBlock\n");
return(tx.nLockTime);
}
void komodo_nutxoadd(int32_t addflag,int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts)
{
struct nutxo_entry *np;

View File

@@ -267,8 +267,7 @@ public:
friend bool operator==(const CTxOut& a, const CTxOut& b)
{
return (a.nValue == b.nValue &&
a.scriptPubKey == b.scriptPubKey);
return (a.nValue == b.nValue && a.scriptPubKey == b.scriptPubKey);
}
friend bool operator!=(const CTxOut& a, const CTxOut& b)

View File

@@ -506,6 +506,7 @@ static bool rest_getutxos(AcceptedConnection* conn,
utxo.push_back(Pair("txvers", (int32_t)coin.nTxVer));
utxo.push_back(Pair("height", (int32_t)coin.nHeight));
utxo.push_back(Pair("value", ValueFromAmount(coin.out.nValue)));
//utxo.push_back(Pair("interest", ValueFromAmount(komodo_interest(coin.out.nValue,coin.nLockTime,chainActive.Tip()->nTime))));
// include the script in a json output
Object o;