More of 10286

This commit is contained in:
UdjinM6 2020-02-28 21:34:40 +03:00 committed by Pasta
parent 381f43a431
commit 1c0acbefe1
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -177,6 +177,11 @@ template<typename SpecialTxPayload>
static void FundSpecialTx(CWallet* pwallet, CMutableTransaction& tx, const SpecialTxPayload& payload, const CTxDestination& fundDest) static void FundSpecialTx(CWallet* pwallet, CMutableTransaction& tx, const SpecialTxPayload& payload, const CTxDestination& fundDest)
{ {
assert(pwallet != nullptr); assert(pwallet != nullptr);
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
LOCK2(cs_main, pwallet->cs_wallet); LOCK2(cs_main, pwallet->cs_wallet);
CTxDestination nodest = CNoDestination(); CTxDestination nodest = CNoDestination();
@ -284,12 +289,14 @@ static void SignSpecialTxPayloadByHash(const CMutableTransaction& tx, SpecialTxP
static std::string SignAndSendSpecialTx(const CMutableTransaction& tx) static std::string SignAndSendSpecialTx(const CMutableTransaction& tx)
{ {
{
LOCK(cs_main); LOCK(cs_main);
CValidationState state; CValidationState state;
if (!CheckSpecialTx(tx, chainActive.Tip(), state)) { if (!CheckSpecialTx(tx, chainActive.Tip(), state)) {
throw std::runtime_error(FormatStateMessage(state)); throw std::runtime_error(FormatStateMessage(state));
} }
} // cs_main
CDataStream ds(SER_NETWORK, PROTOCOL_VERSION); CDataStream ds(SER_NETWORK, PROTOCOL_VERSION);
ds << tx; ds << tx;