Forum Home
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    [Dev] Documenting Feathercoin Specific Software settings - Part 9

    Technical Development
    1
    37
    6248
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wrapper
      wrapper Moderators last edited by

      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

      Fix ACP conflict : - commit

      https://github.com/FeatherCoin/Feathercoin/commit/9a77224a31b47e5d40f365447a6f036c10e75bb6

      src/main.cpp

      Review how ACP is included, cherrypick, updates?

       + #if defined(_MSC_VER) || defined(__MSVCRT__)
       +   /* (s)size_t and ptrdiff_t have the same size specifier in MSVC:
       +      http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx
       +    */
       +   #define PRIszx    "Ix"
       +   #define PRIszu    "Iu"
       +   #define PRIszd    "Id"
       +   #define PRIpdx    "Ix"
       +   #define PRIpdu    "Iu"
       +   #define PRIpdd    "Id"
       + #else /* C99 standard */
       +   #define PRIszx    "zx"
       +   #define PRIszu    "zu"
       +   #define PRIszd    "zd"
       +   #define PRIpdx    "tx"
       +   #define PRIpdu    "tu"
       +   #define PRIpdd    "td"
       + #endif
       + 
      

      Add code

       +//for 0.8.7 ACP
      

      Comment changed

       +    // All modifications to the coin state will be done in this cache.
       +    // Only when all have succeeded, we push it to pcoinsTip.
       +    CCoinsViewCache view(*pcoinsTip, true);
       +    
       +    // Find the fork (typically, there is none)
       +    uint256 hashfork = view.GetBestBlock();
       +    CBlockIndex* pfork = mapBlockIndex.find(hashfork)->second;
       +    CBlockIndex* plonger = pindexNew;
       +    while (pfork && pfork != plonger)
       +    {
       +        while (plonger->nHeight > pfork->nHeight) {
       +            plonger = plonger->pprev;
       +            assert(plonger != NULL);
       +        }
       +        if (pfork == plonger)
       +            break;
       +        pfork = pfork->pprev;
       +        assert(pfork != NULL);
       +    }
       +    
       +    // List of what to disconnect (typically nothing)
       +    vector<CBlockIndex*> vDisconnect;
       +    for (CBlockIndex* pindex = mapBlockIndex.find(hashfork)->second; pindex != pfork; pindex = pindex->pprev)
       +        vDisconnect.push_back(pindex);
       +    
       +    // List of what to connect (typically only pindexNew)
       +    vector<CBlockIndex*> vConnect;
       +    for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev)
       +        vConnect.push_back(pindex);
       +    reverse(vConnect.begin(), vConnect.end());
       +    
       +    if (vDisconnect.size() > 0) {
       +        LogPrintf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str());
       +        LogPrintf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str());
       +    }
       +    
       +    // Disconnect shorter branch
       +    vector<CTransaction> vResurrect;
       +    BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) {
       +        CBlock block;
       +        //if (!block.ReadFromDisk(pindex))
       +        if (!ReadBlockFromDisk(block, pindex))
       +            return state.Abort(_("Failed to read block"));
       +        int64 nStart = GetTimeMicros();
       +        //if (!block.DisconnectBlock(state, pindex, view))
       +        bool fClean = true;
       +        if (!DisconnectBlock(block, state, pindex, view, &fClean))
       +            return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str());
       +        if (fBenchmark)
       +            LogPrintf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001);
       +
       +        // Queue memory transactions to resurrect.
       +        // We only do this for blocks after the last checkpoint (reorganisation before that
       +        // point should only happen with -reindex/-loadblock, or a misbehaving peer.
       +        BOOST_FOREACH(const CTransaction& tx, block.vtx)
       +            if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate())
       +                vResurrect.push_back(tx);
       +    }
       +    
       +    // Connect longer branch
       +    vector<CTransaction> vDelete;
       +    BOOST_FOREACH(CBlockIndex *pindex, vConnect) {
       +        CBlock block;
       +        //if (!block.ReadFromDisk(pindex))
       +        if (!ReadBlockFromDisk(block, pindex))
       +            return state.Abort(_("Failed to read block"));
       +        int64 nStart = GetTimeMicros();
       +        //if (!block.ConnectBlock(state, pindex, view)) {
       +        if (!ConnectBlock(block, state, pindex, view)) {
       +            if (state.IsInvalid()) {
       +                InvalidChainFound(pindexNew);
       +                InvalidBlockFound(pindex,state);
       +            }
       +            return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str());
       +        }
       +        if (fBenchmark)
       +            LogPrintf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001);
       +
       +        // Queue memory transactions to delete
       +        BOOST_FOREACH(const CTransaction& tx, block.vtx)
       +            vDelete.push_back(tx);
       +    }
       +    
       +    // Flush changes to global coin state
       +    int64 nStart = GetTimeMicros();
       +    int nModified = view.GetCacheSize();
       +    assert(view.Flush());
       +    int64 nTime = GetTimeMicros() - nStart;
       +    if (fBenchmark)
       +        LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified);    
       +    
       +    // Make sure it's successfully written to disk before changing memory structure
       +    bool fIsInitialDownload = IsInitialBlockDownload();
       +    if (!fIsInitialDownload || pcoinsTip->GetCacheSize() > nCoinCacheSize) {
       +        // Typical CCoins structures on disk are around 100 bytes in size.
       +        // Pushing a new one to the database can cause it to be written
       +        // twice (once in the log, and once in the tables). This is already
       +        // an overestimation, as most will delete an existing entry or
       +        // overwrite one. Still, use a conservative safety factor of 2.
       +        if (!CheckDiskSpace(100 * 2 * 2 * pcoinsTip->GetCacheSize()))
       +            return state.Error();
       +        FlushBlockFile();
       +        pblocktree->Sync();
       +        if (!pcoinsTip->Flush())
       +            return state.Abort(_("Failed to write to coin database"));
       +    }
       +    
       +    // At this point, all changes have been done to the database.
       +    // Proceed by updating the memory structures.
       +
       +    // Disconnect shorter branch
       +    BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
       +        if (pindex->pprev)
       +            pindex->pprev->pnext = NULL;
       +
       +    // Connect longer branch
       +    BOOST_FOREACH(CBlockIndex* pindex, vConnect)
       +        if (pindex->pprev)
       +            pindex->pprev->pnext = pindex;
       +
       +    // Resurrect memory transactions that were in the disconnected branch
       +    BOOST_FOREACH(CTransaction& tx, vResurrect) {
       +        // ignore validation errors in resurrected transactions
       +        CValidationState stateDummy;
       +        /*if (!tx.AcceptToMemoryPool(stateDummy, true, false))
       +            mempool.remove(tx, true);*/
       +        list<CTransaction> removed;
       +        if (!AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL))
       +            mempool.remove(tx, removed, true);            
       +    }
       +
       +    // Delete redundant memory transactions that are in the connected branch
       +    list<CTransaction> txConflicted;
       +    BOOST_FOREACH(CTransaction& tx, vDelete) {
       +        //mempool.remove(tx);
       +        //mempool.removeConflicts(tx);
       +        list<CTransaction> removed;
       +        mempool.remove(tx, removed);
       +        mempool.removeConflicts(tx, txConflicted);
       +    }
       +    
       +    UpdateTip(pindexNew);
       +    	
       +    std::string strCmd = GetArg("-blocknotify", "");
       +
       +    if (!fIsInitialDownload && !strCmd.empty())
       +    {
       +        boost::replace_all(strCmd, "%s", hashBestChain.GetHex());
       +        boost::thread t(runCommand, strCmd); // thread runs free
       +    }  
       + 
      

      Large section of code added

      1 Reply Last reply Reply Quote 0
      • wrapper
        wrapper Moderators last edited by

        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

        Add Multisgin Page : - commit

        https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

        Include a multi-signature address Page

        src/base58.cpp

         +
         +bool CBitcoinAddress::GetScriptID(CScriptID &scriptID) const {   
         +    /*    if (!IsValid())
         +            return false;
         +        switch (vchVersion) {
         +        case Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS):
         +        case Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS_TEST): {
         +            uint160 id;
         +            memcpy(&id, &vchData[0], 20);
         +            scriptID = CScriptID(id);
         +            return true;
         +        }
         +        default: return false;
         +        }*/        
         +    if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
         +        return false;
         +    uint160 id;
         +    memcpy(&id, &vchData[0], 20);
         +    scriptID = CScriptID(id);
         +    return true;
         +}
         +
        

        Code added

        1 Reply Last reply Reply Quote 0
        • wrapper
          wrapper Moderators last edited by

          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

          Add Multisgin Page : - commit

          https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

          Include a multi-signature address Page

          src/base58.h

           +    bool GetScriptID(CScriptID &scriptID) const;
          

          Code added

          1 Reply Last reply Reply Quote 0
          • wrapper
            wrapper Moderators last edited by

            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

            Add Multisgin Page : - commit

            https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

            Include a multi-signature address Page

            src/bignum.h

             +#include "util.h" // for uint64
            

            Code added

            1 Reply Last reply Reply Quote 0
            • wrapper
              wrapper Moderators last edited by

              Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

              Add Multisgin Page : - commit

              https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

              Include a multi-signature address Page

              src/chainparams.cpp

               -        //vSeeds.push_back(CDNSSeedData("block.ftc-c.com", "block.ftc-c.com"));
               -        //vSeeds.push_back(CDNSSeedData("pool.ftc-c.com", "pool.ftc-c.com"));
              
               +        vSeeds.push_back(CDNSSeedData("block.ftc-c.com", "block.ftc-c.com"));
               +        vSeeds.push_back(CDNSSeedData("pool.ftc-c.com", "pool.ftc-c.com"));
              

              Code replaced

              1 Reply Last reply Reply Quote 0
              • wrapper
                wrapper Moderators last edited by

                Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                Add Multisgin Page : - commit

                https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                Include a multi-signature address Page

                src/core.h

                 +extern int nBestHeight;
                 +static const unsigned int LOCKTIME_THRESHOLD2 = 500000000; // Tue Nov  5 00:53:20 1985 UTC
                

                Code added

                 +    
                 +    bool IsFinal(int nBlockHeight=0, int64 nBlockTime=0) const
                 +    {
                 +        // Time based nLockTime implemented in 0.1.6
                 +        if (nLockTime == 0)
                 +            return true;
                 +        if (nBlockHeight == 0)
                 +            nBlockHeight = nBestHeight;
                 +        if (nBlockTime == 0)
                 +            nBlockTime = GetAdjustedTime();
                 +        if ((int64)nLockTime < ((int64)nLockTime < LOCKTIME_THRESHOLD2 ? (int64)nBlockHeight : nBlockTime))
                 +            return true;
                 +        BOOST_FOREACH(const CTxIn& txin, vin)
                 +            if (!txin.IsFinal())
                 +                return false;
                 +        return true;
                 +    }
                

                Code added

                1 Reply Last reply Reply Quote 0
                • wrapper
                  wrapper Moderators last edited by

                  Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                  Add Multisgin Page : - commit

                  https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                  Include a multi-signature address Page

                  src/qt/Makefile.am

                   -  forms/snapwidget.ui
                  
                   +  forms/snapwidget.ui \
                   +  forms/createmultisigaddrdialog.ui \
                   +  forms/multisigdialog.ui
                  

                  Code replaced

                   +  moc_reportview.cpp \
                   +  moc_createmultisigaddrdialog.cpp \
                   +  moc_multisigdialog.cpp
                  
                   +  reportview.h \
                   +  createmultisigaddrdialog.h \
                   +  multisigdialog.h
                  
                   +  res/icons/account-report.png \
                   +  res/icons/multisig.png
                  
                   +  qimagesource.cpp \
                   +  createmultisigaddrdialog.cpp \
                   +  multisigdialog.cpp
                  

                  Code replaced

                  1 Reply Last reply Reply Quote 0
                  • wrapper
                    wrapper Moderators last edited by

                    Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                    Add Multisgin Page : - commit

                    https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                    Include a multi-signature address Page

                    src/qt/addressbookpage.cpp

                     +#include "signverifymessagedialog.h"
                    
                     +#include "wallet.h"
                     +#include "walletmodel.h"
                     +#include "init.h"
                     +#include "base58.h"
                     +
                     +#include "walletview.h"
                     +#include "createmultisigaddrdialog.h"
                     +
                    

                    Code added

                     +#include "json/json_spirit.h"
                     +#include "json/json_spirit_reader_template.h"
                     +#include "json/json_spirit_writer_template.h"
                     +using namespace json_spirit;
                     +
                    
                     +        ui->signMessage->setVisible(false);
                    
                     +        ui->signMessage->setVisible(true);
                     +        ui->newMultiSigAddress->setVisible(false);
                    
                     +    QAction *sendCoinsAction = new QAction(tr("Send &Coins"), this);
                    
                     +    QAction *signMessageAction = new QAction(ui->signMessage->text(), this);
                     +    QAction *verifyMessageAction = new QAction(ui->verifyMessage->text(), this);
                     +    QAction *copyPubKeyAction = new QAction(tr("Copy &Public Key"), this);
                     +    QAction *copyPriKeyAction = new QAction(tr("Copy Private Key"), this);
                    

                    Code added

                     +    {
                         contextMenu->addAction(deleteAction);
                     +        //contextMenu->addAction(sendCoinsAction);
                     +     }
                    

                    Code added

                     +    if(tab == ReceivingTab)
                     +    {
                     +    		contextMenu->addAction(signMessageAction);
                     +        contextMenu->addAction(copyPubKeyAction);
                     +        contextMenu->addAction(copyPriKeyAction);
                     +    }
                     +    else if(tab == SendingTab)
                     +        contextMenu->addAction(verifyMessageAction);
                     +  
                     +    QAction *MultiSigExportAction = new QAction(tr("Export MultiSig Address"), this);
                     +    contextMenu->addAction(MultiSigExportAction);
                     +    
                     +    contextMenuMultiSig = new QMenu();
                     +    contextMenuMultiSig->addAction(copyAddressAction);
                     +    contextMenuMultiSig->addAction(copyLabelAction);
                     +    contextMenuMultiSig->addAction(editAction);
                     +    contextMenuMultiSig->addAction(deleteAction);
                     +    contextMenuMultiSig->addSeparator();
                     +    //contextMenuMultiSig->addAction(sendCoinsAction);
                     +#ifdef USE_QRCODE
                     +    contextMenuMultiSig->addAction(showQRCodeAction);
                     +#endif
                     +    contextMenuMultiSig->addAction(MultiSigExportAction);
                    

                    Code added

                     +		connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessage_clicked()));
                     +    connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessage_clicked()));
                    
                     +    connect(copyPubKeyAction, SIGNAL(triggered()), this, SLOT(on_copyPubKey_clicked()));
                     +    connect(copyPriKeyAction, SIGNAL(triggered()), this, SLOT(on_copyPriKey_clicked()));
                     +    connect(ui->newMultiSigAddress, SIGNAL(clicked()), this, SLOT(createAddress()));
                     +    connect(MultiSigExportAction, SIGNAL(triggered()), this, SLOT(exportAddress()));
                     +    connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(onSendCoinsAction()));
                    

                    Code added

                     -#if QT_VERSION < 0x050000
                     +/*#if QT_VERSION < 0x050000
                    
                     -#endif
                     +#endif*/
                    

                    Code commented out

                     +		ui->tableView->horizontalHeader()->resizeSection(1, 850);
                     +		//ui->tableView->horizontalHeader()->resizeSection(2, 100);
                     +		ui->tableView->horizontalHeader()->setStretchLastSection(true);
                    

                    UI code changed

                     +void AddressBookPage::on_copyPubKey_clicked()
                     +{
                     +    QModelIndexList selection = ui->tableView->selectionModel()->selectedRows(AddressTableModel::Address);
                     +    if(!selection.isEmpty())
                     +    {
                     +        QString addrStr = selection.at(0).data(Qt::EditRole).toString();
                     +        CBitcoinAddress address(addrStr.toStdString());
                     +        CKeyID keyID;
                     +        if ( !address.GetKeyID(keyID) )
                     +        {
                     +            QMessageBox::warning(this, windowTitle(),
                     +                tr("Address \"%1\" doesn't have public key ").arg(addrStr),
                     +                QMessageBox::Ok, QMessageBox::Ok);
                     +            return;
                     +        }
                     +        CPubKey vchPubKey;
                     +        if ( !pwalletMain->GetPubKey(keyID, vchPubKey))
                     +        {
                     +            QMessageBox::warning(this, windowTitle(),
                     +                tr("Address \"%1\" doesn't have public key ").arg(addrStr),
                     +                QMessageBox::Ok, QMessageBox::Ok);
                     +            return;
                     +        }
                     +        GUIUtil::setClipboard(QString::fromStdString(HexStr(vchPubKey)));
                     +    }
                     +}
                     +
                     +void AddressBookPage::on_copyPriKey_clicked()
                     +{
                     +    QModelIndexList selection = ui->tableView->selectionModel()->selectedRows(AddressTableModel::Address);
                     +    if(!selection.isEmpty())
                     +    {
                     +        QString addrStr = selection.at(0).data(Qt::EditRole).toString();
                     +        CBitcoinAddress address(addrStr.toStdString());
                     +        CKeyID keyID;
                     +        if ( !address.GetKeyID(keyID) )
                     +        {
                     +            QMessageBox::warning(this, windowTitle(),
                     +                tr("Address \"%1\" doesn't have public key ").arg(addrStr),
                     +                QMessageBox::Ok, QMessageBox::Ok);
                     +            return;
                     +        }
                     +        CSecret vchSecret;
                     +	      bool fCompressed;
                     +	      if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
                     +	      {
                     +	          QMessageBox::warning(this, windowTitle(),
                     +	              tr("Address \"%1\" doesn't have private key ").arg(addrStr),
                     +	              QMessageBox::Ok, QMessageBox::Ok);
                     +	          return;
                     +	      }
                     +        GUIUtil::setClipboard(CBitcoinSecret(vchSecret, fCompressed).ToString().c_str());
                     +    }
                     +}
                     +
                     +void AddressBookPage::on_signMessage_clicked()
                     +{
                     +    QTableView *table = ui->tableView;
                     +    QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
                     +
                     +    foreach (QModelIndex index, indexes)
                     +    {
                     +        QString address = index.data().toString();
                     +        //emit signMessage(address);
                     +		    SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(this);
                     +		    signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
                     +		    //signVerifyMessageDialog->setModel(walletModel);
                     +		    signVerifyMessageDialog->showTab_SM(true);
                     +		
                     +		    if (!address.isEmpty())
                     +		        signVerifyMessageDialog->setAddress_SM(address);
                     +    }
                     +}
                     +
                     +void AddressBookPage::on_verifyMessage_clicked()
                     +{
                     +    QTableView *table = ui->tableView;
                     +    QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
                     +
                     +    foreach (QModelIndex index, indexes)
                     +    {
                     +        QString address = index.data().toString();
                     +        //emit verifyMessage(address);
                     +		    SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(this);
                     +		    signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
                     +		    //signVerifyMessageDialog->setModel(walletModel);
                     +		    signVerifyMessageDialog->showTab_VM(true);
                     +		
                     +		    if (!address.isEmpty())
                     +		        signVerifyMessageDialog->setAddress_VM(address);
                     +    }
                     +}
                     +
                    

                    Section of code added

                     +        //contextMenu->exec(QCursor::pos());
                     +        QTableView *table = ui->tableView;
                     +        QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Category);
                     +
                     +        foreach (QModelIndex index1, indexes){
                     +            QString Category = index1.data().toString();
                     +            if ( Category == "MultiSig" )
                     +                contextMenuMultiSig->exec(QCursor::pos());
                     +            else
                     +                contextMenu->exec(QCursor::pos());
                     +
                     +            break;
                     +        }
                    

                    Code replaced

                     +
                     +void AddressBookPage::onSendCoinsAction()
                     +{
                     +    QTableView *table = ui->tableView;
                     +    QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
                     +
                     +    foreach (QModelIndex index, indexes)
                     +    {
                     +        QString address = index.data().toString();
                     +        emit sendCoins(address);
                     +        //parent.gotoSendCoinsPage(address);
                     +        //WalletView(&parent)->gotoSendCoinsPage(address);
                     +        close();
                     +    }
                     +}
                     +
                     +void AddressBookPage::createAddress()
                     +{
                     +    CreateMultiSigAddrDialog dlg(this);
                     +    if(dlg.exec())
                     +    {
                     +    }
                     +}
                     +
                     +bool writeString(const QString &filename, const QString& hex);
                     +void AddressBookPage::exportAddress()
                     +{
                     +    QString s;
                     +    QTableView *table = ui->tableView;
                     +    QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
                     +
                     +    //foreach (QModelIndex index, indexes)
                     +    s = indexes[0].data().toString();
                     +
                     +    CBitcoinAddress address(s.toStdString());
                     +    
                     +    CScript subscript;
                     +    CScriptID scriptID;
                     +    address.GetScriptID(scriptID);
                     +    pwalletMain->GetCScript(scriptID, subscript);
                     +
                     +    json_spirit::Object addrJson;
                     +    addrJson.push_back(json_spirit::Pair("address", address.ToString()));
                     +    addrJson.push_back(json_spirit::Pair("redeemScript", HexStr(subscript.begin(), subscript.end())));
                     +    std::string ss = json_spirit::write_string(json_spirit::Value(addrJson), false);
                     +    QString addrJsonStr = QString::fromStdString(ss);
                     +
                     +    QString filename = GUIUtil::getSaveFileName(
                     +            this,
                     +            tr("Save MultiSig Address"), QString(),
                     +            tr("MultiSig Address file (*.msa)"), NULL);
                     +
                     +    if (filename.isNull()) return;
                     +
                     +    if(!writeString(filename, addrJsonStr))
                     +    {
                     +        QMessageBox::critical(this, tr("Exporting Failed"), tr("Could not write to file %1.").arg(filename),
                     +                              QMessageBox::Abort, QMessageBox::Abort);
                     +    }
                     +} 
                    

                    Code added

                    1 Reply Last reply Reply Quote 0
                    • wrapper
                      wrapper Moderators last edited by

                      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                      Add Multisgin Page : - commit

                      https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                      Include a multi-signature address Page

                      src/qt/addressbookpage.h

                       +    QMenu *contextMenuMultiSig;
                      

                      Code added

                       +    /** Copy public key of currently selected address to clipboard */
                       +    void on_copyPubKey_clicked();
                       +    /** Copy private key of currently selected address to clipboard */
                       +    void on_copyPriKey_clicked();
                       +    /** Open the sign message tab in the Sign/Verify Message dialog with currently selected address */
                       +    void on_signMessage_clicked();
                       +    /** Open the verify message tab in the Sign/Verify Message dialog with currently selected address */
                       +    void on_verifyMessage_clicked();
                       +    /** Open send coins dialog for currently selected address (no button) */
                       +    void onSendCoinsAction();
                      

                      Code added

                       +    
                       +    void createAddress();
                       +    void exportAddress();
                      

                      Code added

                       +    void signMessage(QString addr);
                       +    void verifyMessage(QString addr);
                      

                      Code added

                      1 Reply Last reply Reply Quote 0
                      • wrapper
                        wrapper Moderators last edited by

                        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                        Add Multisgin Page : - commit

                        https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                        Include a multi-signature address Page

                        src/qt/addresstablemodel.cpp

                         +    
                         +    enum Category {
                         +        Normal,
                         +        MultiSig
                         +    };
                        

                        Code added

                         +    AddressTableEntry() { categoryStrList << "Normal" << "MultiSig"; }
                         +    AddressTableEntry(Type type, const QString &label, const QString &address, const bool &stealth = false, Category cate = Normal):
                         +        type(type), label(label), address(address), stealth(stealth), category(cate) { categoryStrList << "Normal" << "MultiSig"; }
                        

                        Code replaced

                         +                const std::string& strName = item.second.name;
                        
                         +                bool fMyShare = IsMyShare(*wallet, address.Get());
                        

                        Code added

                         +                AddressTableEntry::Category cate = AddressTableEntry::Normal;
                         +                if ( fMyShare )
                         +                {
                         +                    cate = AddressTableEntry::MultiSig;
                         +                    addressType = AddressTableEntry::Sending;
                         +                }
                        

                        Code replaced

                         +                                  QString::fromStdString(address.ToString()),false,cate));
                        

                        Code replaced

                         +                                  true,AddressTableEntry::Normal));
                        

                        Code replaced

                         -            cachedAddressTable.insert(lowerIndex, 
                        
                         +            }                       
                                 parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
                        

                        AddressTableEntry(newEntryType, label, address));
                        + if (address.at(0)==‘f’)
                        + {
                        + cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, label, address,false,AddressTableEntry::MultiSig));
                        + }
                        + else
                        + {
                        + cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, label, address,false,AddressTableEntry::Normal));
                        + }

                        Code replaced

                         +    //columns << tr("Label") << tr("Address")<< tr("Category");
                        
                         +        case Category:
                         +            //return rec->categoryStrList[rec->category];
                         +            return rec->category;
                        

                        Code replaced

                        1 Reply Last reply Reply Quote 0
                        • wrapper
                          wrapper Moderators last edited by

                          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                          Add Multisgin Page : - commit

                          https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                          Include a multi-signature address Page

                          src/qt/addresstablemodel.h

                           +        Label = 0,   	/**< User specified label */
                          
                                    Address = 1,  /**< Bitcoin address */
                           -        Type = 2  /**< Address type  */
                           +        Type = 2,  	  /**< Address type  */
                           +        Category = 3  /**< Address Category : Normal or MultiSig*/
                          

                          Code replaced

                          1 Reply Last reply Reply Quote 0
                          • wrapper
                            wrapper Moderators last edited by

                            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                            Add Multisgin Page : - commit

                            https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                            Include a multi-signature address Page

                            src/qt/bitcoingui.cpp

                             +    
                             +    multiSigAction = new QAction(QIcon(":/icons/multisig"), tr("&MultiSig"), this);
                             +    multiSigAction->setStatusTip(tr("Manage MultiSig transactions"));
                             +    multiSigAction->setToolTip(multiSigAction->statusTip());
                             +    multiSigAction->setCheckable(true);
                             +    multiSigAction->setShortcut(QKeySequence(Qt::ALT+ Qt::Key_6));
                             +    tabGroup->addAction(multiSigAction);
                            

                            Code added

                             +    connect(multiSigAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
                             +    connect(multiSigAction, SIGNAL(triggered()), this, SLOT(gotoMultiSigPage()));
                            
                             +        advanced->addAction(multiSigAction);
                            
                             +        toolbar->addAction(multiSigAction);
                            
                             +    multiSigAction->setEnabled(enabled);
                            
                             +void BitcoinGUI::gotoMultiSigPage()
                             +{
                             +		multiSigAction->setChecked(true);
                             +    if (walletFrame) walletFrame->gotoMultiSigPage();
                             +}
                             +
                            

                            Code added

                            1 Reply Last reply Reply Quote 0
                            • wrapper
                              wrapper Moderators last edited by

                              Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                              Add Multisgin Page : - commit

                              https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                              Include a multi-signature address Page

                              src/qt/bitcoingui.h

                               +    QAction *multiSigAction;
                              

                              Code added

                               +    /** Switch to MultiSig page */
                               +    void gotoMultiSigPage();
                               +    
                              

                              Code replaced

                              1 Reply Last reply Reply Quote 0
                              • wrapper
                                wrapper Moderators last edited by

                                Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                Add Multisgin Page : - commit

                                https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                Include a multi-signature address Page

                                src/qt/createmultisigaddrdialog.cpp

                                New file Large amount of new code, 298 lines

                                 +#include "createmultisigaddrdialog.h"
                                 +#include "ui_createmultisigaddrdialog.h"
                                 +
                                 +#include "addresstablemodel.h"
                                 +#include "guiutil.h"
                                 +
                                 +#include "wallet.h"
                                 +#include "base58.h"
                                 +#include "init.h"
                                 +#include "util.h"
                                 +
                                 +#include "json/json_spirit.h"
                                 +#include "json/json_spirit_reader_template.h"
                                 +#include "json/json_spirit_writer_template.h"
                                 +using namespace json_spirit;
                                 +
                                 +#include <QSortFilterProxyModel>
                                 +#include <QClipboard>
                                 +#include <QMessageBox>
                                 +#include <QMenu>
                                 +#include <QTextDocument>
                                 +#include <QScrollBar>
                                 +#include <QFile>
                                 +#include <QTextStream>
                                 +#include <QDataWidgetMapper>
                                 +
                                 +CreateMultiSigAddrDialog::CreateMultiSigAddrDialog(QWidget *parent) :
                                 +    QDialog(parent),
                                 +    ui(new Ui::CreateMultiSigAddrDialog)
                                 +{
                                 +    ui->setupUi(this);
                                 +
                                 +    connect(ui->btnCreate, SIGNAL(clicked()), this, SLOT(create()));
                                 +    connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(cancel()));
                                 +
                                 +    ui->comboBoxRequire->addItem(QString("1"), QVariant(1));
                                 +    ui->comboBoxRequire->addItem(QString("2"), QVariant(2));
                                 +    ui->comboBoxRequire->addItem(QString("3"), QVariant(3));
                                 +    ui->comboBoxRequire->setCurrentIndex(1);
                                 +    
                                 +    ui->comboBoxTotal->addItem(QString("2"), QVariant(2));
                                 +    ui->comboBoxTotal->addItem(QString("3"), QVariant(3));
                                 +    ui->comboBoxTotal->setCurrentIndex(0);
                                 +    currentPubkeyNum = 2;
                                 +    connect(ui->comboBoxTotal, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
                                

                                Start of new file code added

                                1 Reply Last reply Reply Quote 0
                                • wrapper
                                  wrapper Moderators last edited by

                                  Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                  Add Multisgin Page : - commit

                                  https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                  Include a multi-signature address Page

                                  src/qt/createmultisigaddrdialog.h

                                  New file 40 lines code

                                    +#ifndef CREATEMULTISIGADDRESSDIALOG_H
                                   +#define CREATEMULTISIGADDRESSDIALOG_H
                                   +
                                   +#include <QDialog>
                                   +
                                   +QT_BEGIN_NAMESPACE
                                   +class QLabel;
                                   +QT_END_NAMESPACE
                                   +
                                   +namespace Ui {
                                   +    class CreateMultiSigAddrDialog;
                                   +}
                                   +
                                   +/** Dialog for editing an address and associated information.
                                   + */
                                   +class CreateMultiSigAddrDialog : public QDialog
                                   +{
                                   +    Q_OBJECT
                                   +
                                   +public:
                                   +    explicit CreateMultiSigAddrDialog(QWidget *parent = 0);
                                   +    ~CreateMultiSigAddrDialog();
                                   +
                                   +public slots:
                                   +    void create();
                                   +    void cancel();
                                   +    void handleSelectionChanged(int idx);
                                   +    void onTextChanged0(const QString & text);
                                   +    void onTextChanged1(const QString & text);
                                   +    void onTextChanged2(const QString & text);
                                   +    void importAddress();
                                   +    void updatePromptText();
                                   +
                                   +private:
                                   +    Ui::CreateMultiSigAddrDialog *ui;
                                   +    int currentPubkeyNum;
                                   +    void onTextChanged(QLabel* label, const QString & text);
                                   +};
                                   +
                                   +#endif // CREATEMULTISIGADDRESSDIALOG_H
                                  

                                  Code added new file

                                  1 Reply Last reply Reply Quote 0
                                  • wrapper
                                    wrapper Moderators last edited by wrapper

                                    Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                    Add Multisgin Page : - commit

                                    https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                    Include a multi-signature address Page

                                    src/qt/editaddressdialog.cpp

                                     +                tr("The entered address \"%1\" is not a valid Feathercoin address.").arg(ui->addressEdit->text()),
                                    

                                    Name change to Feathercoin

                                    1 Reply Last reply Reply Quote 0
                                    • wrapper
                                      wrapper Moderators last edited by

                                      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                      Add Multisgin Page : - commit

                                      https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                      Include a multi-signature address Page

                                      src/qt/feathercoin.qrc

                                       +        <file alias="multisig">res/icons/multisig.png</file>
                                      

                                      Code added

                                      1 Reply Last reply Reply Quote 0
                                      • wrapper
                                        wrapper Moderators last edited by

                                        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                        Add Multisgin Page : - commit

                                        https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                        Include a multi-signature address Page

                                        src/qt/forms/addressbookpage.ui

                                        Amount of ui changes

                                         +        <string>&amp;New Address</string>
                                         +       </property>
                                         +       <property name="icon">
                                         +        <iconset resource="../feathercoin.qrc">
                                         +         <normaloff>:/icons/add</normaloff>:/icons/add</iconset>
                                         +       </property>
                                         +      </widget>
                                         +     </item>
                                         +     <item>
                                         +      <widget class="QPushButton" name="newMultiSigAddress">
                                         +       <property name="text">
                                         +        <string>New MultiSig</string>
                                        

                                        Example code replaced

                                         +      <widget class="QPushButton" name="signMessage">
                                         +       <property name="toolTip">
                                         +        <string>Sign a message to prove you own a FTC address</string>
                                         +       </property>
                                         +       <property name="text">
                                         +        <string>Sign &amp;Message</string>
                                         +       </property>
                                         +       <property name="icon">
                                         +        <iconset resource="../feathercoin.qrc">
                                         +         <normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
                                         +       </property>
                                         +      </widget>
                                         +     </item>
                                         +     <item>
                                         +      <widget class="QPushButton" name="verifyMessage">
                                         +       <property name="toolTip">
                                         +        <string>Verify a message to ensure it was signed with a specified FTC address</string>
                                         +       </property>
                                         +       <property name="text">
                                         +        <string>&amp;Verify Message</string>
                                         +       </property>
                                         +       <property name="icon">
                                         +        <iconset resource="../feathercoin.qrc">
                                         +         <normaloff>:/icons/transaction_0</normaloff>:/icons/transaction_0</iconset>
                                         +       </property>
                                         +      </widget>
                                         +     </item>
                                         +     <item>
                                        

                                        Code replaced

                                        1 Reply Last reply Reply Quote 0
                                        • wrapper
                                          wrapper Moderators last edited by

                                          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                          Add Multisgin Page : - commit

                                          https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                          Include a multi-signature address Page

                                          src/qt/forms/createmultisigaddrdialog.ui

                                          Large new file, 159 lines of code

                                           +<?xml version="1.0" encoding="UTF-8"?>
                                           +<ui version="4.0">
                                           + <class>CreateMultiSigAddrDialog</class>
                                           + <widget class="QDialog" name="CreateMultiSigAddrDialog">
                                           +  <property name="geometry">
                                           +   <rect>
                                           +    <x>0</x>
                                           +    <y>0</y>
                                           +    <width>506</width>
                                           +    <height>209</height>
                                           +   </rect>
                                           +  </property>
                                           +  <property name="windowTitle">
                                           +   <string>Create MultiSig Address</string>
                                           +  </property>
                                           +  <layout class="QVBoxLayout" name="verticalLayout">
                                           +   <item>
                                           +    <layout class="QVBoxLayout" name="verticalLayout_3">
                                           +     <item>
                                           +      <widget class="QLabel" name="label0">
                                           +       <property name="text">
                                           +        <string>PublicKey</string>
                                           +       </property>
                                           +      </widget>
                                           +     </item>
                                          

                                          Example new code

                                          1 Reply Last reply Reply Quote 0
                                          • wrapper
                                            wrapper Moderators last edited by

                                            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                            Add Multisgin Page : - commit

                                            https://github.com/FeatherCoin/Feathercoin/commit/83737e90c292f18fe0285677cefbd70125492e1a

                                            Include a multi-signature address Page

                                            src/qt/forms/multisigdialog.ui

                                            New file, 729 lines of code

                                             +<?xml version="1.0" encoding="UTF-8"?>
                                             +<ui version="4.0">
                                             + <class>MultiSigDialog</class>
                                             + <widget class="QDialog" name="MultiSigDialog">
                                             +  <property name="geometry">
                                             +   <rect>
                                             +    <x>0</x>
                                             +    <y>0</y>
                                             +    <width>850</width>
                                             +    <height>400</height>
                                             +   </rect>
                                             +  </property>
                                             +  <property name="windowTitle">
                                             +   <string>Send Coins</string>
                                             +  </property>
                                             +  <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
                                             +   <property name="bottomMargin">
                                             +    <number>8</number>
                                             +   </property>
                                             +   <item>
                                             +    <widget class="QFrame" name="frameCoinControl">
                                            

                                            Code added

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post