aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorNicolasDorier <nicolas.dorier@gmail.com>2017-04-07 09:57:06 +0000
committerNicolasDorier <nicolas.dorier@gmail.com>2017-04-13 05:30:52 +0000
commite78bc45810c0834ad47cffcdfb52f0a57bfbba2d (patch)
tree469be3b6616442acdbb2b8f146e0b14b657d7b4c /src/wallet/wallet.h
parentfd44ac1e8b75f6f83cc0fea20ae721de163ff9cc (diff)
downloadbitcoin-e78bc45810c0834ad47cffcdfb52f0a57bfbba2d.tar.xz
[Wallet] Decouple CInputCoin from CWalletTx
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index a882cec778..d43bd4b590 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -475,7 +475,38 @@ public:
};
-using CInputCoin = std::pair<const CWalletTx*, unsigned int>;
+class CInputCoin {
+public:
+ CInputCoin()
+ {
+ }
+ CInputCoin(const CWalletTx* walletTx, unsigned int i)
+ {
+ if (walletTx != nullptr && i < walletTx->tx->vout.size())
+ {
+ outpoint = COutPoint(walletTx->GetHash(), i);
+ txout = walletTx->tx->vout[i];
+ }
+ }
+ bool IsNull() const
+ {
+ return outpoint.IsNull() && txout.IsNull();
+ }
+ COutPoint outpoint;
+ CTxOut txout;
+
+ bool operator<(const CInputCoin& rhs) const {
+ return outpoint < rhs.outpoint;
+ }
+
+ bool operator!=(const CInputCoin& rhs) const {
+ return outpoint != rhs.outpoint;
+ }
+
+ bool operator==(const CInputCoin& rhs) const {
+ return outpoint == rhs.outpoint;
+ }
+};
class COutput
{
@@ -1132,7 +1163,7 @@ bool CWallet::DummySignTx(CMutableTransaction &txNew, const ContainerType &coins
int nIn = 0;
for (const auto& coin : coins)
{
- const CScript& scriptPubKey = coin.first->tx->vout[coin.second].scriptPubKey;
+ const CScript& scriptPubKey = coin.txout.scriptPubKey;
SignatureData sigdata;
if (!ProduceSignature(DummySignatureCreator(this), scriptPubKey, sigdata))