Skip to content

Commit

Permalink
Use TxId when constructing a CTxIn
Browse files Browse the repository at this point in the history
Summary: Increase type safety.

Test Plan:
  make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1433
  • Loading branch information
deadalnix committed May 23, 2018
1 parent 013489c commit b7f75a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void MutateTxAddInput(CMutableTransaction &tx,
throw std::runtime_error("invalid TX input txid");
}

uint256 txid(uint256S(strTxid));
TxId txid(uint256S(strTxid));

static const unsigned int minTxOutSz = 9;
static const unsigned int maxVout = MAX_TX_SIZE / minTxOutSz;
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ class CTxIn {
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn = CScript(),
uint32_t nSequenceIn = SEQUENCE_FINAL)
: prevout(prevoutIn), scriptSig(scriptSigIn), nSequence(nSequenceIn) {}
CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn = CScript(),
CTxIn(TxId prevTxId, uint32_t nOut, CScript scriptSigIn = CScript(),
uint32_t nSequenceIn = SEQUENCE_FINAL)
: CTxIn(COutPoint(hashPrevTx, nOut), scriptSigIn, nSequenceIn) {}
: CTxIn(COutPoint(prevTxId, nOut), scriptSigIn, nSequenceIn) {}

ADD_SERIALIZE_METHODS;

Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static bool AcceptToMemoryPoolWorker(
AssertLockHeld(cs_main);

const CTransaction &tx = *ptx;
const uint256 txid = tx.GetId();
const TxId txid = tx.GetId();
if (pfMissingInputs) {
*pfMissingInputs = false;
}
Expand Down

0 comments on commit b7f75a2

Please sign in to comment.