mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
ui: Add "Copy raw transaction data" to transaction list context menu
Add a way to quickly copy transaction hex. Primarily useful when manually submitting transactions, e.g. `-walletbroadcast=0` is set.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "transactionrecord.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
#include "core_io.h"
|
||||
#include "main.h"
|
||||
#include "sync.h"
|
||||
#include "uint256.h"
|
||||
@@ -220,6 +221,18 @@ public:
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString getTxHex(TransactionRecord *rec)
|
||||
{
|
||||
LOCK2(cs_main, wallet->cs_wallet);
|
||||
std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
|
||||
if(mi != wallet->mapWallet.end())
|
||||
{
|
||||
std::string strHex = EncodeHexTx(static_cast<CTransaction>(mi->second));
|
||||
return QString::fromStdString(strHex);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
};
|
||||
|
||||
TransactionTableModel::TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent):
|
||||
@@ -594,6 +607,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||
return rec->getTxID();
|
||||
case TxHashRole:
|
||||
return QString::fromStdString(rec->hash.ToString());
|
||||
case TxHexRole:
|
||||
return priv->getTxHex(rec);
|
||||
case ConfirmedRole:
|
||||
return rec->status.countsForBalance;
|
||||
case FormattedAmountRole:
|
||||
|
||||
Reference in New Issue
Block a user