getting close

This commit is contained in:
blackjok3r
2018-11-02 09:42:53 +08:00
parent 0ea25a07b1
commit 73c0dd2b2e

View File

@@ -1212,29 +1212,35 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
{ {
uint256 hash; CTransaction txin; CTxDestination address; int numvinIsOurs, numvoutIsOurs; int64_t totalvoutvalue;
if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) for (size_t i = 0; i < tx.vin.size(); i++) {
{ uint256 hash; CTransaction txin; CTxDestination address;
if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false))
fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); {
if (mapAddressBook.count(address)) if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) {
fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str());
} if (!mapAddressBook.count(address)) {
fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str());
numvinIsOurs++;
}
}
}
} }
if ( numvinIsOurs == 0 ) {
int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) {
for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2;
totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) {
if (!mapAddressBook.count(address2)) {
if (IsChange(tx.vout[i])) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str());
fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); numvoutIsOurs++;
} else { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue;
totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; }
}
fprintf(stderr, "this is not change? vout %ld = %ld\n", i, tx.vout[i].nValue); }
} } else if ( numvinIsOurs < tx.vin.size() ) {
fprintf(stderr, "There are vins that are not ours, notarisation?\n");
} }
fprintf(stderr, "total sent from some other kunts to us is : %ldsats\n", totalvoutvalue);
CWalletTx wtx(this,tx); CWalletTx wtx(this,tx);