mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Allow CInputCoin to also be constructed with COutPoint and CTxOut
This commit is contained in:
parent
2949ea924f
commit
698340b62a
1 changed files with 37 additions and 0 deletions
|
|
@ -6,7 +6,9 @@
|
|||
#define BITCOIN_WALLET_COINSELECTION_H
|
||||
|
||||
#include <amount.h>
|
||||
#include <chainparams.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <primitives/bitcoin/transaction.h>
|
||||
#include <random.h>
|
||||
|
||||
//! target minimum change amount
|
||||
|
|
@ -26,6 +28,41 @@ public:
|
|||
m_input_bytes = input_bytes;
|
||||
}
|
||||
|
||||
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in)
|
||||
{
|
||||
outpoint = outpoint_in;
|
||||
txout = txout_in;
|
||||
if (txout.nValue.IsExplicit()) {
|
||||
effective_value = txout_in.nValue.GetAmount();
|
||||
value = txout.nValue.GetAmount();
|
||||
asset = txout.nAsset.GetAsset();
|
||||
} else {
|
||||
effective_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in, int input_bytes) : CInputCoin(outpoint_in, txout_in)
|
||||
{
|
||||
m_input_bytes = input_bytes;
|
||||
}
|
||||
|
||||
CInputCoin(const COutPoint& outpoint_in, const Sidechain::Bitcoin::CTxOut& txout_in)
|
||||
{
|
||||
outpoint = outpoint_in;
|
||||
effective_value = txout_in.nValue;
|
||||
txout.SetNull();
|
||||
txout.scriptPubKey = txout_in.scriptPubKey;
|
||||
txout.nValue.SetToAmount(txout_in.nValue);
|
||||
txout.nAsset.SetToAsset(Params().GetConsensus().pegged_asset);
|
||||
asset = Params().GetConsensus().pegged_asset;
|
||||
value = txout_in.nValue;
|
||||
}
|
||||
|
||||
CInputCoin(const COutPoint& outpoint_in, const Sidechain::Bitcoin::CTxOut& txout_in, int input_bytes) : CInputCoin(outpoint_in, txout_in)
|
||||
{
|
||||
m_input_bytes = input_bytes;
|
||||
}
|
||||
|
||||
COutPoint outpoint;
|
||||
CTxOut txout;
|
||||
CAmount effective_value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue