mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#14906: Make explicit CMutableTransaction -> CTransaction conversion
This commit is contained in:
parent
b50aab204d
commit
ee705af2cd
@ -491,7 +491,7 @@ bool CCoinJoinClientSession::SendDenominate(const std::vector<std::pair<CTxDSIn,
|
||||
|
||||
// store our entry for later use
|
||||
LOCK(cs_coinjoin);
|
||||
vecEntries.emplace_back(vecTxDSInTmp, vecTxOutTmp, txMyCollateral);
|
||||
vecEntries.emplace_back(vecTxDSInTmp, vecTxOutTmp, CTransaction(txMyCollateral));
|
||||
RelayIn(vecEntries.back(), connman);
|
||||
nTimeLastSuccessfulStep = GetTime();
|
||||
|
||||
@ -923,7 +923,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CConnman& connman, bool fDr
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!CCoinJoin::IsCollateralValid(txMyCollateral)) {
|
||||
if (!CCoinJoin::IsCollateralValid(CTransaction(txMyCollateral))) {
|
||||
LogPrint(BCLog::COINJOIN, "CCoinJoinClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n");
|
||||
if (!CreateCollateralTransaction(txMyCollateral, strReason)) {
|
||||
LogPrint(BCLog::COINJOIN, "CCoinJoinClientSession::DoAutomaticDenominating -- create collateral error: %s\n", strReason);
|
||||
|
@ -324,7 +324,7 @@ void CCoinJoinServer::CreateFinalTransaction(CConnman& connman)
|
||||
|
||||
// request signatures from clients
|
||||
SetState(POOL_STATE_SIGNING);
|
||||
RelayFinalTransaction(finalMutableTransaction, connman);
|
||||
RelayFinalTransaction(CTransaction(finalMutableTransaction), connman);
|
||||
}
|
||||
|
||||
void CCoinJoinServer::CommitFinalTransaction(CConnman& connman)
|
||||
@ -701,7 +701,7 @@ bool CCoinJoinServer::IsAcceptableDSA(const CCoinJoinAccept& dsa, PoolMessage& n
|
||||
}
|
||||
|
||||
// check collateral
|
||||
if (!fUnitTest && !CCoinJoin::IsCollateralValid(dsa.txCollateral)) {
|
||||
if (!fUnitTest && !CCoinJoin::IsCollateralValid(CTransaction(dsa.txCollateral))) {
|
||||
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- collateral not valid!\n", __func__);
|
||||
nMessageIDRet = ERR_INVALID_COLLATERAL;
|
||||
return false;
|
||||
|
@ -137,7 +137,7 @@ CTransactionBuilder::CTransactionBuilder(std::shared_ptr<CWallet> pwalletIn, con
|
||||
dummyBatch.TxnAbort();
|
||||
dummyScript = ::GetScriptForDestination(dummyPubkey.GetID());
|
||||
// Calculate required bytes for the dummy signed tx with tallyItem's inputs only
|
||||
nBytesBase = CalculateMaximumSignedTxSize(dummyTx, pwallet.get(), false);
|
||||
nBytesBase = CalculateMaximumSignedTxSize(CTransaction(dummyTx), pwallet.get(), false);
|
||||
}
|
||||
// Calculate the output size
|
||||
nBytesOutput = ::GetSerializeSize(CTxOut(0, dummyScript), SER_NETWORK, PROTOCOL_VERSION);
|
||||
|
@ -772,7 +772,7 @@ static int CommandLineRawTx(int argc, char* argv[])
|
||||
MutateTx(tx, key, value);
|
||||
}
|
||||
|
||||
OutputTx(tx);
|
||||
OutputTx(CTransaction(tx));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
strPrint = std::string("error: ") + e.what();
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
CTransaction();
|
||||
|
||||
/** Convert a CMutableTransaction into a CTransaction. */
|
||||
CTransaction(const CMutableTransaction &tx);
|
||||
explicit CTransaction(const CMutableTransaction &tx);
|
||||
CTransaction(CMutableTransaction &&tx);
|
||||
|
||||
template <typename Stream>
|
||||
|
@ -543,7 +543,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2]);
|
||||
|
||||
return EncodeHexTx(rawTx);
|
||||
return EncodeHexTx(CTransaction(rawTx));
|
||||
}
|
||||
|
||||
static UniValue decoderawtransaction(const JSONRPCRequest& request)
|
||||
@ -765,7 +765,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||
UpdateInput(txin, sigdata);
|
||||
}
|
||||
|
||||
return EncodeHexTx(mergedTx);
|
||||
return EncodeHexTx(CTransaction(mergedTx));
|
||||
}
|
||||
|
||||
UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore *keystore, bool is_temp_keystore, const UniValue& hashType)
|
||||
@ -891,7 +891,7 @@ UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival
|
||||
bool fComplete = vErrors.empty();
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("hex", EncodeHexTx(mtx));
|
||||
result.pushKV("hex", EncodeHexTx(CTransaction(mtx)));
|
||||
result.pushKV("complete", fComplete);
|
||||
if (!vErrors.empty()) {
|
||||
result.pushKV("errors", vErrors);
|
||||
|
@ -234,7 +234,7 @@ static void FundSpecialTx(CWallet* pwallet, CMutableTransaction& tx, const Speci
|
||||
template<typename SpecialTxPayload>
|
||||
static void UpdateSpecialTxInputsHash(const CMutableTransaction& tx, SpecialTxPayload& payload)
|
||||
{
|
||||
payload.inputsHash = CalcTxInputsHash(tx);
|
||||
payload.inputsHash = CalcTxInputsHash(CTransaction(tx));
|
||||
}
|
||||
|
||||
template<typename SpecialTxPayload>
|
||||
@ -276,7 +276,7 @@ static std::string SignAndSendSpecialTx(const CMutableTransaction& tx, bool fSub
|
||||
LOCK(cs_main);
|
||||
|
||||
CValidationState state;
|
||||
if (!CheckSpecialTx(tx, chainActive.Tip(), state, *pcoinsTip.get())) {
|
||||
if (!CheckSpecialTx(CTransaction(tx), chainActive.Tip(), state, *pcoinsTip.get())) {
|
||||
throw std::runtime_error(FormatStateMessage(state));
|
||||
}
|
||||
} // cs_main
|
||||
@ -549,7 +549,7 @@ static UniValue protx_register(const JSONRPCRequest& request)
|
||||
SetTxPayload(tx, ptx);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("tx", EncodeHexTx(tx));
|
||||
ret.pushKV("tx", EncodeHexTx(CTransaction(tx)));
|
||||
ret.pushKV("collateralAddress", EncodeDestination(txDest));
|
||||
ret.pushKV("signMessage", ptx.MakeSignString());
|
||||
return ret;
|
||||
|
@ -3326,7 +3326,7 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
|
||||
FundTransaction(pwallet, tx, fee, change_position, request.params[1]);
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("hex", EncodeHexTx(tx));
|
||||
result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
|
||||
result.pushKV("fee", ValueFromAmount(fee));
|
||||
result.pushKV("changepos", change_position);
|
||||
|
||||
|
@ -3681,7 +3681,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
|
||||
|
||||
auto calculateFee = [&](CAmount& nFee) -> bool {
|
||||
AssertLockHeld(cs_wallet);
|
||||
nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly);
|
||||
nBytes = CalculateMaximumSignedTxSize(CTransaction(txNew), this, coin_control.fAllowWatchOnly);
|
||||
if (nBytes < 0) {
|
||||
strFailReason = _("Signing transaction failed");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user