diff --git a/src/test/undo_tests.cpp b/src/test/undo_tests.cpp --- a/src/test/undo_tests.cpp +++ b/src/test/undo_tests.cpp @@ -65,8 +65,7 @@ block.vtx[0] = MakeTransactionRef(tx); tx.vout[0].scriptPubKey = CScript() << OP_TRUE; - tx.vin[0].prevout.hash = InsecureRand256(); - tx.vin[0].prevout.n = 0; + tx.vin[0].prevout = COutPoint(InsecureRand256(), 0); tx.vin[0].nSequence = CTxIn::SEQUENCE_FINAL; tx.vin[0].scriptSig.resize(0); tx.nVersion = 2; @@ -74,7 +73,7 @@ auto prevTx0 = CTransaction(tx); AddCoins(view, prevTx0, 100); - tx.vin[0].prevout.hash = prevTx0.GetId(); + tx.vin[0].prevout = COutPoint(prevTx0.GetId(), 0); auto tx0 = CTransaction(tx); block.vtx[1] = MakeTransactionRef(tx0); diff --git a/src/txdb.cpp b/src/txdb.cpp --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -41,14 +41,17 @@ template void Serialize(Stream &s) const { s << key; - s << outpoint->hash; - s << VARINT(outpoint->n); + s << outpoint->GetTxId(); + s << VARINT(outpoint->GetN()); } template void Unserialize(Stream &s) { s >> key; - s >> outpoint->hash; - s >> VARINT(outpoint->n); + uint256 id; + s >> id; + uint32_t n; + s >> VARINT(n); + *outpoint = COutPoint(id, n); } }; } // namespace @@ -424,13 +427,13 @@ return error("%s: cannot parse CCoins record", __func__); } - COutPoint outpoint(key.second, 0); + TxId id(key.second); for (size_t i = 0; i < old_coins.vout.size(); ++i) { if (!old_coins.vout[i].IsNull() && !old_coins.vout[i].scriptPubKey.IsUnspendable()) { Coin newcoin(std::move(old_coins.vout[i]), old_coins.nHeight, old_coins.fCoinBase); - outpoint.n = i; + COutPoint outpoint(id, i); CoinEntry entry(&outpoint); batch.Write(entry, newcoin); }