X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fcoincontroldialog.cpp;h=7b7472b5ba133954bc0d6b460695025e9567f97b;hb=f8ea0dd6459856f2df18ca2ad532d49432a087dd;hp=3f67ee658a0d3be229435dd7e4d1cb7bf8373fa8;hpb=fbd44e84d5841867d36d295d4f347fd5e55d293f;p=novacoin.git diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 3f67ee6..7b7472b 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -4,6 +4,7 @@ #include "init.h" #include "base58.h" #include "bitcoinunits.h" +#include "script.h" #include "walletmodel.h" #include "addresstablemodel.h" #include "optionsmodel.h" @@ -469,17 +470,21 @@ void CoinControlDialog::updateLabels(WalletModel *model, QWidget* dialog) dPriorityInputs += (double)out.tx->vout[out.i].nValue * (out.nDepth+1); // Bytes - CTxDestination address; - if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) + CBitcoinAddress address; + if(ExtractAddress(*pwalletMain, out.tx->vout[out.i].scriptPubKey, address)) { - CPubKey pubkey; - CKeyID *keyid = boost::get< CKeyID >(&address); - if (keyid && model->getPubKey(*keyid, pubkey)) - nBytesInputs += (pubkey.IsCompressed() ? 148 : 180); - else - nBytesInputs += 148; // in all error cases, simply assume 148 here + if (address.IsPair()) + nBytesInputs += 213; + else if (address.IsPubKey()) + { + CPubKey pubkey; + CKeyID keyid; + if (address.GetKeyID(keyid) && model->getPubKey(keyid, pubkey)) + nBytesInputs += (pubkey.IsCompressed() ? 148 : 180); + else + nBytesInputs += 148; // in all error cases, simply assume 148 here + } } - else nBytesInputs += 148; } // calculation @@ -631,10 +636,10 @@ void CoinControlDialog::updateView() itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); // address -/* - CTxDestination outputAddress; + CBitcoinAddress outputAddress; QString sAddress = ""; - if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress)) + + if(ExtractAddress(*pwalletMain, out.tx->vout[out.i].scriptPubKey, outputAddress)) { sAddress = CBitcoinAddress(outputAddress).ToString().c_str(); @@ -642,56 +647,13 @@ void CoinControlDialog::updateView() if (!treeMode || (!(sAddress == sWalletAddress))) itemOutput->setText(COLUMN_ADDRESS, sAddress); - CPubKey pubkey; - CKeyID *keyid = boost::get< CKeyID >(&outputAddress); - if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed()) - nInputSize = 180; - } -*/ - QString sAddress = ""; - txnouttype whichType; - std::vector vSolutions; - if (Solver(out.tx->vout[out.i].scriptPubKey, whichType, vSolutions)) - { - CTxDestination address; - if (whichType == TX_PUBKEY) + if (outputAddress.IsPubKey()) { - // Pay-to-Pubkey - CPubKey pubKey = CPubKey(vSolutions[0]); - address = pubKey.GetID(); - sAddress = CBitcoinAddress(address).ToString().c_str(); - - if (!pubKey.IsCompressed()) - nInputSize = 180; - } - else if (whichType == TX_PUBKEYHASH) - { - // Pay-to-PubkeyHash - address = CKeyID(uint160(vSolutions[0])); - sAddress = CBitcoinAddress(address).ToString().c_str(); - CPubKey pubkey; - CKeyID *keyid = boost::get< CKeyID >(&address); - if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed()) + CKeyID keyid; + if (outputAddress.GetKeyID(keyid) && model->getPubKey(keyid, pubkey) && !pubkey.IsCompressed()) nInputSize = 180; } - else if (whichType == TX_SCRIPTHASH) - { - // Pay-to-ScriptHash - address = CScriptID(uint160(vSolutions[0])); - sAddress = CBitcoinAddress(address).ToString().c_str(); - } - else if (whichType == TX_PUBKEY_DROP) - { - // Pay-to-Pubkey-R - CMalleableKeyView view; - pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view); - sAddress = CBitcoinAddress(view.GetMalleablePubKey()).ToString().c_str(); - } - - // if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs - if (!treeMode || (!(sAddress == sWalletAddress))) - itemOutput->setText(COLUMN_ADDRESS, sAddress); } // label