Permalink
Browse files

Block Browser Fix Inputs

  • Loading branch information...
Tranz5 committed Sep 3, 2014
1 parent 05f78d0 commit f4f3986924e14bfa34606081e78e6b6cca92486f
Showing with 6 additions and 29 deletions.
  1. +6 −28 src/qt/blockbrowser.cpp
  2. +0 −1 src/qt/blockbrowser.h
@@ -222,7 +222,6 @@ std::string getOutputs(std::string txid)
std::string getInputs(std::string txid)
{
//Tranz this needs major work.
uint256 hash;
hash.SetHex(txid);
@@ -231,31 +230,25 @@ std::string getInputs(std::string txid)
if (!GetTransaction(hash, tx, hashBlock))
return "N/A";
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
std::string str = "";
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
uint256 hash;
const CTxIn& vin = tx.vin[i];
hash.SetHex(vin.prevout.hash.ToString());
CTransaction wtxPrev;
uint256 hashBlock = 0;
if (!GetTransaction(hash, wtxPrev, hashBlock))
return "N/A";
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << wtxPrev;
CTxDestination address;
if (!ExtractDestination(wtxPrev.vout[vin.prevout.n].scriptPubKey, address) )
address = CNoDestination();
CTxDestination source;
ExtractDestination(wtxPrev.vout[vin.prevout.n].scriptPubKey, source);
CBitcoinAddress addressSource(source);
std::string lol6 = addressSource.ToString();
const CScript target = wtxPrev.vout[vin.prevout.n].scriptPubKey;
double buffer = convertCoins(getInputValue(wtxPrev, target));
double buffer = convertCoins(wtxPrev.vout[vin.prevout.n].nValue);
std::string amount = boost::to_string(buffer);
str.append(lol6);
str.append(CBitcoinAddress(address).ToString());
str.append(": ");
str.append(amount);
str.append(" HBN");
@@ -265,21 +258,6 @@ std::string getInputs(std::string txid)
return str;
}
int64 getInputValue(CTransaction tx, CScript target)
{
//Tranz needs work
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const CTxOut& txout = tx.vout[i];
if(txout.scriptPubKey == target)
{
return txout.nValue;
}
}
//return 0;
}
double BlockBrowser::getTxFees(std::string txid)
{
uint256 hash;
@@ -31,7 +31,6 @@ std::string getBlockHash(int64);
std::string getBlockMerkle(int64);
bool addnode(std::string);
const CBlockIndex* getBlockIndex(int64);
int64 getInputValue(CTransaction, CScript);
namespace Ui {

0 comments on commit f4f3986

Please sign in to comment.