Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/xbridge/xbridgewalletconnectorpart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,4 +458,38 @@ bool PartWalletConnector::createPaymentTransaction(const std::vector<XTxIn> & in
return true;
}

//******************************************************************************
//******************************************************************************
bool PartWalletConnector::createPartialTransaction(const std::vector<XTxIn> inputs,
const std::vector<std::pair<std::string, double> > outputs,
std::string & txId,
std::string & rawTx)
{
XParticlTransaction tx = createTransaction(*this, inputs, outputs, COIN, txVersion, 0, txWithTimeField);
rawTx = tx.toString();

// sign
bool complete = false;
if (!rpc::signRawTransaction(m_user, m_passwd, m_ip, m_port, rawTx, complete)) {
LOG() << "sign transaction error " << __FUNCTION__;
return false;
}

if (!complete) {
LOG() << "transaction not fully signed " << __FUNCTION__;
return false;
}

std::string partialTxid;
std::string json;
if (!rpc::decodeRawTransaction(m_user, m_passwd, m_ip, m_port, rawTx, partialTxid, json)) {
LOG() << "decode signed transaction error " << __FUNCTION__;
return false;
}

txId = partialTxid;

return true;
}

} // namespace xbridge
5 changes: 5 additions & 0 deletions src/xbridge/xbridgewalletconnectorpart.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class PartWalletConnector : public BtcWalletConnector<BtcCryptoProvider>
const std::vector<unsigned char> & innerScript,
std::string & txId,
std::string & rawTx) override;

bool createPartialTransaction(const std::vector<XTxIn> inputs,
const std::vector<std::pair<std::string, double> > outputs,
std::string & txId,
std::string & rawTx) override;
};

} // namespace xbridge
Expand Down