Changeset View
Changeset View
Standalone View
Standalone View
src/coins.cpp
Show First 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | for (const CTxIn &txin : tx.vin) { | ||||
inChainInputValue += coin.GetTxOut().nValue; | inChainInputValue += coin.GetTxOut().nValue; | ||||
} | } | ||||
} | } | ||||
return tx.ComputePriority(dResult); | return tx.ComputePriority(dResult); | ||||
} | } | ||||
// TODO: merge with similar definition in undo.h. | // TODO: merge with similar definition in undo.h. | ||||
static const size_t MAX_OUTPUTS_PER_TX = | static const size_t MAX_OUTPUTS_PER_TX = | ||||
MAX_TX_SIZE / ::GetSerializeSize(CTxOut(), SER_NETWORK, PROTOCOL_VERSION); | MAX_TX_SIZE / ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION); | ||||
const Coin &AccessByTxid(const CCoinsViewCache &view, const TxId &txid) { | const Coin &AccessByTxid(const CCoinsViewCache &view, const TxId &txid) { | ||||
for (uint32_t n = 0; n < MAX_OUTPUTS_PER_TX; n++) { | for (uint32_t n = 0; n < MAX_OUTPUTS_PER_TX; n++) { | ||||
const Coin &alternate = view.AccessCoin(COutPoint(txid, n)); | const Coin &alternate = view.AccessCoin(COutPoint(txid, n)); | ||||
if (!alternate.IsSpent()) { | if (!alternate.IsSpent()) { | ||||
return alternate; | return alternate; | ||||
} | } | ||||
} | } | ||||
return coinEmpty; | return coinEmpty; | ||||
} | } |